Skip to content
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

Deprecate level keyword for dataframe and series aggregations #40869

Merged
merged 6 commits into from Apr 13, 2021

Conversation

phofl
Copy link
Member

@phofl phofl commented Apr 10, 2021

This would deprecate the level keyword if we want to move forward with this

@phofl phofl added Groupby Numeric Operations Arithmetic, Comparison, and Logical operations Deprecate Functionality to remove in pandas labels Apr 10, 2021
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

wouldn't be averse to change some of the tests to use the groupby instead of the reduction method to remove / avoid the warnings (some, not all)

@@ -492,6 +492,7 @@ Using the parameter ``level`` in the :meth:`~DataFrame.reindex` and
values across a level. For instance:

.. ipython:: python
:okwarning:
Copy link
Contributor

Choose a reason for hiding this comment

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

would just remove this example

Copy link
Contributor

Choose a reason for hiding this comment

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

may instead show a groupby example of this (but then i would put it in the groupby section), you can leave a pointer if you'd like here

Copy link
Member Author

Choose a reason for hiding this comment

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

If ok, I would keep it there, there are level examples above and below this snippet

Copy link
Member Author

Choose a reason for hiding this comment

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

But changed to groupby

@@ -625,6 +625,7 @@ even if some categories are not present in the data:
``DataFrame`` methods like :meth:`DataFrame.sum` also show "unused" categories.

.. ipython:: python
:okwarning:
Copy link
Contributor

Choose a reason for hiding this comment

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

can you change this so its a regular group op

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@@ -325,6 +325,7 @@ directly. Additionally, the resulting index will be named according to the
chosen level:

.. ipython:: python
Copy link
Contributor

Choose a reason for hiding this comment

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

point the example from advanced.rst here (and make this a proper groupby example)

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed, since above is the groupby case

pandas/core/frame.py Show resolved Hide resolved
pandas/core/generic.py Show resolved Hide resolved
pandas/core/series.py Show resolved Hide resolved
@@ -16,17 +16,22 @@ def test_count_multiindex(self, multiindex_dataframe_random_data):
frame = frame.copy()
frame.index.names = ["a", "b"]

result = frame.count(level="b")
expected = frame.count(level=1)
with tm.assert_produces_warning(FutureWarning):
Copy link
Contributor

Choose a reason for hiding this comment

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

can you move these to a new test_count_with_level_deprecated

Copy link
Member Author

Choose a reason for hiding this comment

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

yep, done

@phofl
Copy link
Member Author

phofl commented Apr 12, 2021

wouldn't be averse to change some of the tests to use the groupby instead of the reduction method to remove / avoid the warnings (some, not all)

Most of the tests are pretty basic and already covered in groupby, the more complicated ones are mostly checking if the aggregation with level equals a groupby, so don't know if this makes sense here?

@jreback
Copy link
Contributor

jreback commented Apr 13, 2021

wouldn't be averse to change some of the tests to use the groupby instead of the reduction method to remove / avoid the warnings (some, not all)

Most of the tests are pretty basic and already covered in groupby, the more complicated ones are mostly checking if the aggregation with level equals a groupby, so don't know if this makes sense here?

kk sounds good

@jreback jreback merged commit 815053e into pandas-dev:master Apr 13, 2021
@jreback
Copy link
Contributor

jreback commented Apr 13, 2021

thanks @phofl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecate Functionality to remove in pandas Groupby Numeric Operations Arithmetic, Comparison, and Logical operations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate: level parameter for aggregations in DataFrame and Series
2 participants