Closed
Description
The numpy way
In [183]: x
Out[183]:
one two
0 1 a
2 2 c
3 3 d
4 4 d
5 5 d
In [184]: np.unique(x['two'].values,return_inverse=True)
Out[184]: (array(['a', 'c', 'd'], dtype=object), array([0, 1, 2, 2, 2]))
The pandas way - maybe provide a better API to this
maybe: uniques, indexer = Index(x['two']).get_uniques()
??
In [186]: uniques = x['two'].unique()
In [187]: uniques
Out[187]: array(['a', 'c', 'd'], dtype=object)
In [188]: Index(uniques).get_indexer_non_unique(x['two'])
Out[188]: (Int64Index([0, 1, 2, 2, 2], dtype=int64), array([], dtype=int64))