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: dask group by with kwargs #1676

Merged
merged 6 commits into from
Jan 4, 2025
Merged

Conversation

FBruzzesi
Copy link
Member

What type of PR is this? (check all applicable)

  • πŸ’Ύ Refactor
  • ✨ Feature
  • πŸ› Bug Fix
  • πŸ”§ Optimization
  • πŸ“ Documentation
  • βœ… Test
  • 🐳 Other

Related issues

Checklist

  • Code follows style guide (ruff)
  • Tests added
  • Documented the changes

If you have comments or can explain your changes, please do so below

@FBruzzesi FBruzzesi changed the title Feat/dask group by var std fix: dask group by with kwargs Dec 29, 2024
def var(
ddof: int = 1,
) -> Callable[
[pd.core.groupby.generic.SeriesGroupBy], pd.core.groupby.generic.SeriesGroupBy
Copy link
Member Author

Choose a reason for hiding this comment

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

I need to double check the return type

narwhals/_dask/group_by.py Outdated Show resolved Hide resolved

import dask_expr as dx

return partial(dx._groupby.GroupBy.var, ddof=ddof)
Copy link
Member Author

Choose a reason for hiding this comment

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

The minimum version we support for dask is "dask[dataframe]==2024.7", which installs dask-expr==1.1.8, and dx._groupby.GroupBy is already available.

Copy link
Member

Choose a reason for hiding this comment

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

@phofl is there a public variant of this?

@FBruzzesi FBruzzesi added fix high priority Your PR will be reviewed very quickly if you address this labels Jan 3, 2025
Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

awesome, thanks a lot @FBruzzesi !

if we can use a public variant for dask expr's groupby, then that'd probably be better, else i think this is ok (we test against their nightlies anyway)

@FBruzzesi
Copy link
Member Author

FBruzzesi commented Jan 4, 2025

Thanks for reviewing @MarcoGorelli πŸ‘Œ

if we can use a public variant for dask expr's groupby, then that'd probably be better, else i think this is ok (we test against their nightlies anyway)

It's definitly not exposed in dask-expr.

As mentioned in the discourse thread we could use dd.groupby.DataFrameGroupBy until the current dask version. But we would encounter the same issue from this month release onwards.

@MarcoGorelli
Copy link
Member

Just caught up with Patrick from Dask, and he's said that they plan to merge dask-expr into dask and then they'll expose some public apis, and that we can merge as-is for now

@MarcoGorelli MarcoGorelli merged commit 223cb2e into main Jan 4, 2025
24 checks passed
@MarcoGorelli MarcoGorelli deleted the feat/dask-group-by-var-std branch January 4, 2025 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix high priority Your PR will be reviewed very quickly if you address this
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: group_by context ignores expr arguments
2 participants