Answers for "unique list of value in a python dictionary"

3

find all unique items in dictionary value python

L = [{"V":"S001"}, {"V": "S002"}, {"VI": "S001"}, {"VI": "S005"}, {"VII":"S005"}, {"V":"S009"},{"VIII":"S007"}]
print("Original List: ",L)
u_value = set( val for dic in L for val in dic.values())
print("Unique Values: ",u_value)
Posted by: Guest on September-25-2020
1

how to unique list in python

import numpy as np

def unique(list1):
    npArray1 = np.array(list1)
    uniqueNpArray1 = np.unique(npArray1)
    return uniqueNpArray.tolist()
  
list1 = [10, 20, 10, 30, 40, 40]
unique(list1) # [10, 20, 30, 40]
Posted by: Guest on January-07-2022

Code answers related to "unique list of value in a python dictionary"

Python Answers by Framework

Browse Popular Code Answers by Language