-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
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
DEPR: SeriesGroupBy.agg with dict argument #50684
Comments
Also #9052 |
Hmm doesn't this mean dictionary inputs have different interpretations when I thought normally, a dictionary input e.g. |
Yes - DataFrameGroupBy.agg and SeriesGroupBy.agg will have different semantics. I'm not in favor for it also because users can just rename after the groupby. However, this partially works (with I think we can resolve the inconsistency by enabling it for
Thoughts? |
I see. I would be okay with enabling it for 2.0 and hopefully deprecating passing dicts in agg when it's a |
Makes sense. I'll add the deprecation to the linked PR. |
@mroeschke - I overlooked a better solution. We can maintain the current behavior and move forward with progress toward #46944. This is the approach I took in #50744. I think I overlooked this because it's odd to do I've reworked this issue to be about the remaining deprecation. |
Edit: Instead of implementing the
as_index=True
case mentioned below, theas_index=False
case should be deprecated, and the docs to SeriesGroupBy.agg should be updated. See the discussion below for details.According to #15931 (comment), this was deprecated in 0.20.0 and raises on main now:
However, the docs say
SeriesGroupBy.agg
supports dict arguments. Also, whenas_index=False
it worksThis is because when
as_index=False
, using__getitem__
with"b"
still returns a DataFrameGroupBy.Assuming the implementation in this case isn't difficult, I'm thinking the easiest way forward is to support dictionaries in SeriesGroupBy.agg.
cc @jreback, @jorisvandenbossche
The text was updated successfully, but these errors were encountered: