Reputation: 7806
If you have a groupby object based on a dask dataframe why does len(<groupby object>)
return an error? (bug or feature)
Upvotes: 5
Views: 380
Reputation: 57251
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.
Upvotes: 3