-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
SeriesGroupBy.agg
does not accept Aggregate
s when passed as kwargs
#10836
Comments
@flying-sheep, thanks for creating this issue. Please provide a minimal reproducer (see http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports for guidelines) to allow us to investigate your problem. |
Not really necessary, you can directly see the problem in the linked line, but sure. import pandas as pd
import dask.dataframe as dd
custom_sum = dd.Aggregation(
name='custom_sum',
chunk=lambda s: s.sum(),
agg=lambda s0: s0.sum()
)
df = pd.DataFrame(dict(a=[1, 1, 1, 1, 1], g=[5, 6, 6, 6, 7]))
ddf = dd.from_pandas(df, npartitions=2)
ddf.groupby('g')['a'].agg(sum="sum").compute() # works
ddf.groupby('g')['a'].agg(sum=custom_sum).compute() # broken |
Thanks for adding the reproducer! Please keep in mind that the time of contributors is limited, so having a reproducer ready allows us to move more quickly. It is also a great starting point for a regression test. |
dd.Aggregate
sdd.Aggregate
s when passed as kwargs
dd.Aggregate
s when passed as kwargsSeriesGroupBy.agg
does not accept Aggregate
s when passed as kwargs
It uses pandas’ validation function, which doesn’t recognize dask’s
Aggregate
class:dask/dask/dataframe/groupby.py
Line 2279 in 99036c4
The text was updated successfully, but these errors were encountered: