If you have a groupby object based on a dask dataframe why does len(<groupby object>)
return an error? (bug or feature)
This just hasn't been implemented. You might want to raise an issue (or better yet, a pull request). Pragmatically I would just call nunique
on your grouping object
g = df.groupby(df.x + df.y)
result = len(g)
result = (df.x + df.y).nunique()
Operationally this is nicer because it can be lazy (the result of len
in Python must be a concrete integer) and because you can choose the nunique_approx
variant, which will be far faster.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With