pyspark.pandas.Series.cat.codes

property cat.codes

Return Series of codes as well as the index.

Examples

>>> s = ps.Series(list("abbccc"), dtype="category")
>>> s  
0    a
1    b
2    b
3    c
4    c
5    c
dtype: category
Categories (3, object): ['a', 'b', 'c']
>>> s.cat.codes
0    0
1    1
2    1
3    2
4    2
5    2
dtype: int8