I have a list of ndarrays and I want to find the number of unique ndarrays in it.
For example:
l = [ np.array([1,2,3]), np.array([2,3,4]), np.array([1,2,3]) ]
l
=> [array([1, 2, 3]), array([2, 3, 4]), np.array([1,2,3])]
np.unique(l) expected outcome:
=> [array([1, 2, 3]), array([2, 3, 4])]
When I try to use np.unique() I get TypeError: unhashable type: 'numpy.ndarray'
Can anyone suggest an efficient way to get this? (I can use map, calc some hash value from the arrays and run up.unique on that, but I'm wondering if there is a better way.)
Thanks!