📅  最后修改于: 2022-03-11 14:46:39.792000             🧑  作者: Mango
>>> a = np.array(['a', 'b', 'b', 'c', 'a'])
>>> u, indices = np.unique(a, return_index=True)
>>> u
array(['a', 'b', 'c'], dtype='>> indices
array([0, 1, 3])
>>> a[indices]
array(['a', 'b', 'c'], dtype='