Closed
Description
In [4]: import pandas as pd, numpy as np
In [5]: sr = pd.Series([1,2, np.nan], dtype="O").astype("category")
...: sr
...:
Out[5]:
0 1.0
1 2.0
2 NaN
dtype: category
Categories (2, int64): [1, 2]
In [6]: sr[0]
Out[6]: 1.0
Shouldn't it keep them as ints? Interestingly, pd.Series(["a", 1,2, np.nan], dtype="O").astype("category")
doesn't do the conversion.