-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
Tests for Deprecate SparseArray for python 3.6 and 3.7 and fixes to other deprecation tests #30799
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
4ace5eb
fix deprecation test for python 3.7
Dr-Irv 76dbae4
sparsearray OK for 3.6
Dr-Irv 2bbc831
handle 3.6/3.7 diffs
Dr-Irv def8d28
formatted for black
Dr-Irv a32d4dc
Merge remote-tracking branch 'upstream/master' into sparsedepr
Dr-Irv ea7b959
split test_api for 3.6 vs 3.7
Dr-Irv 385f6d3
Merge branch 'sparsedepr' of https://github.com/Dr-Irv/pandas into sp…
Dr-Irv f5d0357
Merge branch 'sparsedepr' of https://github.com/Dr-Irv/pandas into sp…
Dr-Irv 2e0bab0
datetime fixes
Dr-Irv 52a7d03
Merge branch 'sparsedepr' of https://github.com/Dr-Irv/pandas into sp…
Dr-Irv 5c59f84
make datetime work with 3.6
Dr-Irv 461b0fc
Merge remote-tracking branch 'upstream/master' into sparsedepr
Dr-Irv f1b89f4
use instancecheck. Modify SparseArray for 3.6 to use metaclass pattern
Dr-Irv f08ffc9
Merge branch 'sparsedepr' of https://github.com/Dr-Irv/pandas into sp…
Dr-Irv aa73611
Merge remote-tracking branch 'upstream/master' into sparsedepr
Dr-Irv 4b7e4bf
Merge branch 'sparsedepr' of https://github.com/Dr-Irv/pandas into sp…
Dr-Irv c31afa1
fix mypy issue for methods with no arguments
Dr-Irv 26dc90a
Merge remote-tracking branch 'upstream/master' into sparsedepr
Dr-Irv 7861c98
snake_case and better returns on isinstance
Dr-Irv 7947a81
shorten up imports for datetime and SparseArray
Dr-Irv d78ecea
revert import simplification to make mypy happy
Dr-Irv 7cce2c7
Merge remote-tracking branch 'upstream/master' into sparsedepr
Dr-Irv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
sparsearray OK for 3.6
- Loading branch information
commit 76dbae4e9d5fb4a38d63f471126dece15ca1baf8
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I am not sure we can do it this way for SparseArray, as that breaks isinstance checks
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.
To confirm, you mean something like
will be false? Since it's an instance of the parent
pd.arrays.SparseArray, not the childpd.SparseArray?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.
Yes.
(in general, deprecating moving classes is annoying)
For
datetimeandnpthe same is true of course, but I think it is much less likely that someone will do that.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.
This is again another issue with python 3.6 handling the deprecation of a module attribute. That's why they implemented PEP 562 (https://www.python.org/dev/peps/pep-0562/) for python 3.7. Making a reference using python 3.6 to
pd.SparseArray(without a constructor) produce a warning would be quite involved (see the Rationale in the PEP discussion), and I don't think it is worth introducing that level of complexity to pandas to handle deprecation messages of a class for users of an older version of python.It's why I suggested above to merge in this pull request, and we can leave this as an open issue.
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.
I know it's an issue with python 3.6, but that we still support 3.6 now is a reality we have to live with.
So my suggestion would be to simply don't try to raise a warning in python 3.6, and just import the existing class in that case (by the time we are going to enforce this deprecation, we maybe won't support py3.6 anymore, so then that is less of an issue). Or simply don't deprecate pd.SparseArray at all.
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.
That's probably my preference until we support just 3.7+.
Though @Dr-Irv this PR is also fixing other issues with the other deprecations on master? Taking a closer look now.
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.
@TomAugspurger Yes, there were other issues with deprecations on master that I addressed, especially in the testing code.