-
-
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
COMPAT: remove Categorical pickle compat with Pandas < 0.16 #27538
Conversation
8a8a650
to
bcf842d
Compare
why close? ive been looking forward to seeing these big chunks of pickle compat code removed |
Sorry, I saw there were errors, and don't have time today to figure them out and didn't want to leave a failing PR open too long. I'll open the PR again, when I figure out the problem. |
bcf842d
to
890a902
Compare
Reopened and tests passed. |
37e5881
to
68ef5a1
Compare
@jbrockmendel , agree with these changes? |
pandas/tests/io/test_common.py
Outdated
@@ -222,7 +222,7 @@ def test_read_expands_user_home_dir( | |||
(pd.read_sas, "os", ("io", "sas", "data", "test1.sas7bdat")), | |||
(pd.read_json, "os", ("io", "json", "data", "tsframe_v012.json")), | |||
(pd.read_msgpack, "os", ("io", "msgpack", "data", "frame.mp")), | |||
(pd.read_pickle, "os", ("io", "data", "categorical_0_14_1.pickle")), | |||
(pd.read_pickle, "os", ("io", "data", "categorical.pickle")), |
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.
should there be a version number on this?
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.
Yeah, that will probably be easier for future maintenance. Will add it.
Small question, otherwise LGTM |
68ef5a1
to
f5f98b9
Compare
I’ve renamed the file. |
@jbrockmendel ? Ok to pull in? |
pickle compat is way outside my area of expertise. @jorisvandenbossche? |
else: | ||
state["_ordered"] = False | ||
|
||
# 0.21.0 CategoricalDtype change |
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.
why is there a 025 pickle
file included? this is covered by the legacy pickle dukes no?
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 test test_read_fspath_all
tests if reading custom file paths (CustomFS
) returns an expected value. Seems reasonable that a pickle are included for that testing. Adding 0.25 in the name is not strictly necessary, but can possibly be handy info to have.
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 comment
The 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 comment
The 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.
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.
lgtm. I don't have a problem with the inclusion of the 0.25 file but am indifferent if we want to do away with it as well
@@ -67,6 +67,8 @@ Removal of prior version deprecations/changes | |||
- :meth:`pandas.Series.str.cat` does not accept list-likes *within* list-likes anymore (:issue:`27611`) | |||
- Removed the previously deprecated :meth:`ExtensionArray._formatting_values`. Use :attr:`ExtensionArray._formatter` instead. (:issue:`23601`) | |||
- Removed the previously deprecated ``IntervalIndex.from_intervals`` in favor of the :class:`IntervalIndex` constructor (:issue:`19263`) | |||
- Ability to read pickles containing :class:`Categorical` instances created with pre-0.16 version of pandas has been removed (:issue:`27538`) |
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...
@topper-123 can you merge master on this to be safe? If no other feedback in 2 days let's get this merged |
f5f98b9
to
79663fb
Compare
I've rebased. |
Thanks @topper-123 |
There are other <0.16 pickle tests out there. Can we get rid of those too? |
I think so - we are only guaranteed backwards compatible to pandas 0.20.3 as of the 0.25 release see #27082 |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
Removes Categorical pickle compat with Pandas < 0.16.
I've added a
categorical.pickle
file to replace the deprecated file. It was create like this: