I am trying to use groupby and np.std to calculate a standard deviation, but it seems to be calculating a sample standard deviation (with a degrees of freedom equal to 1).
For degree of freedom = 0
degree of freedom = 0
(This means that bins with one number will end up with std=0 instead of NaN)
std=0
NaN
import numpy as np def std(x): return np.std(x) df.groupby('A').agg(['mean', 'max', std])