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
pd.__version__
Out[158]: '1.1.3'
df = pd.DataFrame({'col': [1,2,3],
'group' : ['a',np.NaN,'b']})
df
Out[160]:
col group
0 1 a
1 2 NaN
2 3 b
df.groupby('group').apply(lambda x: x)
Out[161]:
col group
0 1.0 a
1 NaN NaN
2 3.0 b
There are a few things that are puzzling.
I thought groupby would drop the NA groups by default
Why is the variable col set to missing?
This looks like a bug to me, unless I am missing something (apologies if this is the case)
What do you think?
Thanks!
The text was updated successfully, but these errors were encountered:
Hello there,
Consider this simple example
There are a few things that are puzzling.
groupby
would drop the NA groups by defaultcol
set to missing?This looks like a bug to me, unless I am missing something (apologies if this is the case)
What do you think?
Thanks!
The text was updated successfully, but these errors were encountered: