python get unique from array code example
Example: return position of a unique value in python array
def partition(array):
return {i: (array == i).nonzero()[0] for i in np.unique(array)}
def partition(array):
return {i: (array == i).nonzero()[0] for i in np.unique(array)}