You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This has the same behavior as Pandas, but sometimes it's desired to keep the null values as rows in the output. We should consider adding a dropna param which lets users control this behavior.
We can do this via a workaround with a sentinel and fillna and replace, but this is annoying to manage, and lowers overall workflow perf:
df['id'] = df['id'].fillna(-1)
res = df.groupby('id').val.sum().reset_index()
res['id'] = res['id'].replace(-1, None)
res
Uh oh!
There was an error while loading. Please reload this page.
Currently when you run a groupby, any nulls in the key column are dropped from the output:
This has the same behavior as Pandas, but sometimes it's desired to keep the null values as rows in the output. We should consider adding a
dropna
param which lets users control this behavior.We can do this via a workaround with a sentinel and
fillna
andreplace
, but this is annoying to manage, and lowers overall workflow perf:EDIT - Changed suggested param from
keep_nulls
todropna
to match Pandas's API per Keith's comment.The text was updated successfully, but these errors were encountered: