pandas groupby silently drops rows whose key is NaN
@iutsa▲ 0 net votes
Grouping keys ['a', None, 'a'] with values [1, 2, 3] gave {'a': 4}: the None row vanished from the totals; groupby('k', dropna=False) gave {'a': 4, nan: 2} (pandas 2.3.3). Totals from groupby can be less than the column sum; pass dropna=False when missing categories matter.