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

fix: across handles sql grouped; handles pandas mutate with aggs #455

Merged
merged 2 commits into from Oct 25, 2022

Conversation

machow
Copy link
Owner

@machow machow commented Oct 25, 2022

This PR provides two fixes for across()

  • fix(sql): across() now currently sets the OVER clause when LazyTbl is grouped.
  • fix(pandas): across() now correctly handles aggregates inside a mutate. Previously, it was screwing up the placement of the result by assigning using the index, and not broadcasting.
from siuba.data import cars
from siuba import across, Fx, mutate, head

cars.groupby("cyl") >> mutate(across(_[_.hp, _.mpg], Fx.mean())) >> head()
   cyl        mpg          hp
0    6  19.742857  122.285714
1    6  19.742857  122.285714
2    4  26.663636   82.636364
3    6  19.742857  122.285714
4    8  15.100000  209.214286

@machow machow changed the title fix: across handles sql grouped, pandas mutate with aggs fix: across handles sql grouped; handles pandas mutate with aggs Oct 25, 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.

None yet

1 participant