-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
CLN: remove unused NDFrame methods #30935
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
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'm all for code simplification, but I'm a little in the dark here as to some of the changes, especially those that don't look like "removing unused methods"
Related issue numbers and / or comments in the PR discussion would be good to clarify.
pandas/core/generic.py
Outdated
labels = result._data.axes[axis] | ||
result._data.set_axis(axis, labels.swaplevel(i, j)) | ||
return result | ||
raise AbstractMethodError(self) |
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.
Rationale?
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.
is it because of the additional copy parameter in Series.swaplevel that the generic method cannot retained and frame and series call super in preference to removing the generic implementation.
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.
can this be removed entirely?
pandas/core/generic.py
Outdated
|
||
new_axis = labels.take(sort_index) | ||
return self.reindex(**{axis_name: new_axis}) | ||
raise AbstractMethodError(self) |
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.
Rationale?
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.
actually can you just remove this entirely? its defined in both series/frame with doc-strings.
@@ -548,9 +548,6 @@ def test_validate_bool_args(self): | |||
with pytest.raises(ValueError): | |||
super(DataFrame, df).drop("a", axis=1, inplace=value) | |||
|
|||
with pytest.raises(ValueError): | |||
super(DataFrame, df).sort_index(inplace=value) | |||
|
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 this being dropped?
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 guess this would technically raise an AbstractMethodError now; indifferent on whether should update the error or keep removed
But would be nice to update this test for Python3 super calls and parametrization
@gfyoung both Series and DataFrame override the methods you're asking about (and dont user super()...) |
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. Good to get some of the axis stuff cleaned up
@@ -548,9 +548,6 @@ def test_validate_bool_args(self): | |||
with pytest.raises(ValueError): | |||
super(DataFrame, df).drop("a", axis=1, inplace=value) | |||
|
|||
with pytest.raises(ValueError): | |||
super(DataFrame, df).sort_index(inplace=value) | |||
|
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 guess this would technically raise an AbstractMethodError now; indifferent on whether should update the error or keep removed
But would be nice to update this test for Python3 super calls and parametrization
pandas/core/generic.py
Outdated
|
||
new_axis = labels.take(sort_index) | ||
return self.reindex(**{axis_name: new_axis}) | ||
raise AbstractMethodError(self) |
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.
actually can you just remove this entirely? its defined in both series/frame with doc-strings.
pandas/core/generic.py
Outdated
labels = result._data.axes[axis] | ||
result._data.set_axis(axis, labels.swaplevel(i, j)) | ||
return result | ||
raise AbstractMethodError(self) |
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.
can this be removed entirely?
swaplevel can be removed easily. sort_index DataFrame gets the docstring from NDFrame. can move that over |
updated+green |
thanks @jbrockmendel |
No description provided.