Categorical Data
https://pandas.pydata.org/pandas-docs/stable/user_guide/categorical.html
Object Creation
Series Creation
Categorical Series or columns in a DataFrame can be created in several ways:
By specifying dtype="category" when constructing a Series:
In [1]: s = pd.Series(["a", "b", "c", "a"], dtype="category")
In [2]: s
Out[2]:
0 a
1 b
2 c
3 a
dtype: category
Categories (3, object): [a, b, c]
好的心态+正确的方法
浙公网安备 33010602011771号