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]
>>> items = [1, 2, 0, 1, 3, 2]
>>> list(dict.fromkeys(items)) # Or [*dict.fromkeys(items)] if you prefer
[1, 2, 0, 3]
def get_unique(seq):
seen = set()
seen_add = seen.add
return [x for x in seq if not (x in seen or seen_add(x))]
list(dict.fromkeys(list_with_duplicates))