Skip to content

Conversation

ZanirP
Copy link
Contributor

@ZanirP ZanirP commented Mar 13, 2025

Issue: Previously, if a Series had ordered=True, using astype("category") would incorrectly preserve the ordering. This was inconsistent and against expectations.

Fix:

  1. Now, dtype="category" always implies ordered=False.
  2. If ordered=True before conversion, a deprecation warning is raised to inform users.
  3. Tests have been updated to verify this new behavior.

Copy link
Member

@mroeschke mroeschke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR.

While I support this change, I think we would need more discussion from the core team before proceeding with this deprecation

@mroeschke
Copy link
Member

Going to close this PR pending discussion on the original issue. We can reopen once there is more consensus on moving forward here

@mroeschke mroeschke closed this Apr 14, 2025
@ZanirP ZanirP deleted the Zanir-testing branch May 23, 2025 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DEPR: Make dtype="category" always imply ordered=False

2 participants