Koalas: ks.groupby won't drop groups with one or more null keys

Created on 5 Nov 2019  路  7Comments  路  Source: databricks/koalas

This is basically where the pandas groupby adopts its behaviour from r.
I can submit a pr if this is not on anyones roadmap

bug

Most helpful comment

@LucasG0 Awesome, please go ahead! Thanks!
cc @itholic as working on pandas 1.1 support

All 7 comments

pyspark doesn't drop null groups. I didn't know this.

>>> sdf.show()
+----+
|   x|
+----+
|null|
| 1.0|
| 1.0|
+----+

>>> sdf.groupBy('x').count().show()
+----+-----+
|   x|count|
+----+-----+
|null|    1|
| 1.0|    2|
+----+-----+

>>> sdf.toPandas().groupby('x').agg({'x': 'count'})
     x
x   
1.0  2

@harupy correct. That is to keep it consistent with r library

Yeah, I noticed this behaviour as well lately. Please go ahead for a PR!

Okay thanks, I'm on it

Hi, pandas 1.1.0 recently added a dropna parameter in order to allow groupby on null keys.
By default (True), null keys are dropped, and it has pyspark behavior when set to False.
I think it would be interesting to add it to koalas dataframe groupby method.
May i work on it ?

@LucasG0 Awesome, please go ahead! Thanks!
cc @itholic as working on pandas 1.1 support

Thanks, @LucasG0 .
And thanks for the notice, @ueshin

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Callum027 picture Callum027  路  6Comments

mks2192 picture mks2192  路  4Comments

ThiagoCM picture ThiagoCM  路  3Comments

shril picture shril  路  5Comments

patryk-oleniuk picture patryk-oleniuk  路  3Comments