-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
COMPAT: remove Categorical pickle compat with Pandas < 0.16 #27538
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1350,24 +1350,7 @@ def __setstate__(self, state): | |
if not isinstance(state, dict): | ||
raise Exception("invalid pickle state") | ||
|
||
# Provide compatibility with pre-0.15.0 Categoricals. | ||
if "_categories" not in state and "_levels" in state: | ||
state["_categories"] = self.dtype.validate_categories(state.pop("_levels")) | ||
if "_codes" not in state and "labels" in state: | ||
state["_codes"] = coerce_indexer_dtype( | ||
state.pop("labels"), state["_categories"] | ||
) | ||
|
||
# 0.16.0 ordered change | ||
if "_ordered" not in state: | ||
|
||
# >=15.0 < 0.16.0 | ||
if "ordered" in state: | ||
state["_ordered"] = state.pop("ordered") | ||
else: | ||
state["_ordered"] = False | ||
|
||
# 0.21.0 CategoricalDtype change | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is there a 025 pickle There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test Probably this test could instead test if temp files are read correctly back in, but that would be for another PR, IMO. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we already have round trip categorical pickle tests There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't mean test round-tripping, but use roundtripping in this test, rather than keeping a file in /data. |
||
# compat with pre 0.21.0 CategoricalDtype change | ||
if "_dtype" not in state: | ||
state["_dtype"] = CategoricalDtype(state["_categories"], state["_ordered"]) | ||
|
||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whatsnew for v0.25.0 already states that we dropped pickle support prior to 0.20.3 so this isn't necessary, though I guess doesn't hurt to include
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it is ok to include this, given that something won't work that previously did work...