-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
Open
Labels
CategoricalCategorical Data TypeCategorical Data TypeDeprecateFunctionality to remove in pandasFunctionality to remove in pandas
Description
Currently one can specify dtype="category" to specify data as CategoricalDtype, and since it does not convey ordered information, we treat it as ordered=None internally in order to no-op data that is already categorical. Therefore internally, there are scenarios where we need to be mindful if we have ordered=None vs ordered=True/False
To simplify this gymnastics, it would be great if dtype="category" always meant CategoricalDtype(ordered=False). I think we would only need to issue a deprecation warning when specifying dtype="category" when the data is categorical and ordered=True
Metadata
Metadata
Assignees
Labels
CategoricalCategorical Data TypeCategorical Data TypeDeprecateFunctionality to remove in pandasFunctionality to remove in pandas
Activity
ZanirP commentedon Mar 13, 2025
Hi! I would love to take this!
Just to clarify, the goal is to make
dtype="category"always meanCategoricalDtype(ordered=False), with a deprecation warning when applied toCategoricalDtype(ordered=True).So for example:
Current behavior is:
CategoricalDtype(categories=['high', 'low', 'medium'], ordered=True, categories_dtype=object)Expected behavior is:
CategoricalDtype(categories=['high', 'low', 'medium'], ordered=False, categories_dtype=object)with a deprecation warning being raised (to inform users that ordering is being removed)?Let me know if this sounds good!
ZanirP commentedon Mar 13, 2025
take