This is probably a really stupid question, but I have searched and cannot find an answer anywhere (probably because it's too stupid a question).
I have a 2D
NumPy
array with multiple columns. I want to identify unique
elements in the 1st
or 2nd
column, but not in the rest of the columns:
array([['A', 'B', '3', '4'],
['C', 'D', '3', '5']],
dtype='|S1')
Using np.unique
will get unique values in the array, and I can index a single column like so:
np.unique(example_array[:,0])
Out[16]:
array(['A', 'C'],
dtype='|S1')
How can I index it so that I can find all the unique values in [;,0]
and in [:,1]
?