Dask aggregate nunique

Hello guys,
I am converting some of my codes from pandas to dask due to dataframe size increase.

One on my codes where like this

Dataframe.groupby([‘A’,‘B’,‘C’]). aggregate ({‘d’:‘sum’, ‘e’:‘nunique’}).

My question is that dask does not recognize the nunique method. I’ve been looking for dask documentation and only found a way to apply it to a series only.

Is there a simple way to " keep" my old code using dask?

Hi @frbelotto, welcome to Dask community,

AFAIK, there is no way to use nunique like that currently. I don’t know if this could be implemented.

So you wont be able to keep your code, you’ll need to modify it a bit:

Dataframe.groupby([‘A’,‘B’,‘C’]).aggregate({'d':'sum'})
Dataframe.groupby([‘A’,‘B’,‘C’]).e.nunique()

You mean using two separate queries, right? I’ve done that for now and using a merge after that

Thanks anyway.

1 Like

By the way, if you think that Dask should implement this feature as Pandas is, please open a feature request on dask github issue tracker, and it would be great if you could contribute!