-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
DEPR: Hide deprecated attrs _AXIS_NAMES & _AXIS_NUMBERS #38740
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
Conversation
jorisvandenbossche
left a comment
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.
Thanks!
pandas/tests/frame/test_api.py
Outdated
| with warnings.catch_warnings(record=True) as wrn: | ||
| # _AXIS_NUMBERS, _AXIS_NAMES lookups | ||
| inspect.getmembers(df) | ||
|
|
||
| # some versions give FutureWarning, others DeprecationWarning | ||
| assert len(wrn) | ||
| assert any(x.category in [FutureWarning, DeprecationWarning] for x in wrn) | ||
| # some versions may give FutureWarning, others DeprecationWarning | ||
| assert not len(wrn) |
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 seems like unrelated to the actual test for constructor_expanddim. Maybe split it in two separate tests?
jorisvandenbossche
left a comment
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.
Thanks for the update!
We could maybe add a small 1.2.1 whatsnew note, not sure if it is worth it
pandas/tests/frame/test_api.py
Outdated
| def test_inspect_getmembers(self): | ||
| # GH38740 | ||
| df = DataFrame() | ||
|
|
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.
could use assert_produces_warning(None) here, but really nobd.
jreback
left a comment
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 think a note is warrented here in 1.2.1 in the deprecation section is fine
|
Updated. |
|
thanks @topper-123 very nice! |
|
@meeseeksdev backport 1.2.x |
… & _AXIS_NUMBERS
…UMBERS (#38755) Co-authored-by: Terji Petersen <contribute@tensortable.com>
black pandasgit diff upstream/master -u -- "*.py" | flake8 --diffUsers that do e.g.
[getattr(pd.DataFrame, x) for x in dir(pd.DataFrame())]orinspect.getmembers(pd.DataFrame())currently get an unfriendly deprecation warning. This fixes that by adding_AXIS_NAMES&_AXIS_NUMBERSto_hidden_attrs.@JSunRae, is it possible for you to add this to your pandas source code and see if this fixes your problem?
xref: #33637