Код: Выделить всё
cat = pd.Categorical(
values=['a', 'b', 'd', 'f'],
categories=['b', 'a', 'c', 'd', 'e', 'f'],
ordered=True
)
cat.dtype
Код: Выделить всё
CategoricalDtype(categories=['b', 'a', 'c', 'd', 'e', 'f'], ordered=True, categories_dtype=object)
Код: Выделить всё
cs1 = pd.Series(cat)
cs1
Код: Выделить всё
0 a
1 b
2 d
3 f
dtype: category
Categories (6, object): ['b' < 'a' < 'c' < 'd' < 'e' < 'f']

Я ожидаю, что вывод будет «категория», а не «объект»
Подробнее здесь: https://stackoverflow.com/questions/790 ... ical-dtype