Skip to content

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

Merged
merged 4 commits into from
Jan 15, 2020
Merged

Conversation

jbrockmendel
Copy link
Member

No description provided.

@gfyoung gfyoung added Clean DataFrame DataFrame data structure labels Jan 12, 2020
Copy link
Member

@gfyoung gfyoung left a 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.

labels = result._data.axes[axis]
result._data.set_axis(axis, labels.swaplevel(i, j))
return result
raise AbstractMethodError(self)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rationale?

Copy link
Member

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.

Copy link
Contributor

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?


new_axis = labels.take(sort_index)
return self.reindex(**{axis_name: new_axis})
raise AbstractMethodError(self)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rationale?

Copy link
Contributor

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)

Copy link
Member

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?

Copy link
Member

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

@jbrockmendel
Copy link
Member Author

@gfyoung both Series and DataFrame override the methods you're asking about (and dont user super()...)

Copy link
Member

@WillAyd WillAyd left a 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)

Copy link
Member

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

@jreback jreback added this to the 1.1 milestone Jan 14, 2020

new_axis = labels.take(sort_index)
return self.reindex(**{axis_name: new_axis})
raise AbstractMethodError(self)
Copy link
Contributor

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.

labels = result._data.axes[axis]
result._data.set_axis(axis, labels.swaplevel(i, j))
return result
raise AbstractMethodError(self)
Copy link
Contributor

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?

@jbrockmendel
Copy link
Member Author

swaplevel can be removed easily. sort_index DataFrame gets the docstring from NDFrame. can move that over

@jbrockmendel
Copy link
Member Author

updated+green

@jreback jreback merged commit 4ed9a39 into pandas-dev:master Jan 15, 2020
@jreback
Copy link
Contributor

jreback commented Jan 15, 2020

thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the cln-generic branch January 15, 2020 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean DataFrame DataFrame data structure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants