Skip to content

fix for NamedAgg in agg and aggregate in pandas #138

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 1 commit into from
Feb 7, 2022

Conversation

bschnurr
Copy link
Member

@bschnurr bschnurr commented Feb 1, 2022

agg = aggregate

pandas source
https://github.com/pandas-dev/pandas/blob/da0156a302f3f7c25bfee0b410bb23865b76f3dd/pandas/core/groupby/generic.py#L247

import pandas as pd

df_groups = pd.DataFrame().groupby("X")
reveal_type(df_groups)  # DataFrameGroupBy

df_groups.agg(x=pd.NamedAgg("a", "count"))
df_groups.agg(x=pd.NamedAgg("a", "count"), y=pd.NamedAgg("b", "count"))
df_groups.aggregate(x=pd.NamedAgg("a", "count"), y=pd.NamedAgg("b", "count"))

@bschnurr bschnurr requested a review from gramster February 1, 2022 19:51
@gramster
Copy link
Member

gramster commented Feb 1, 2022

We should probably just add a agg = aggregate line and remove the duplicate signatures. E.g. like here:

@bschnurr
Copy link
Member Author

bschnurr commented Feb 1, 2022

hmm. downside is our hover is broken
agg
image

aggregate
image

@bschnurr
Copy link
Member Author

bschnurr commented Feb 2, 2022

for now i want to keep it separated

@gramster gramster merged commit 99ac3e1 into microsoft:main Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants