You need to convert timedelta to some numerical value, for example int64 by values which are the most accurate, because the conversion to ns is what is the numerical representation of timedelta :
dropped['new'] = dropped['diff'].values.astype(np.int64) means = dropped.groupby('bank').mean() means['new'] = pd.to_timedelta(means['new']) std = dropped.groupby('bank').std() std['new'] = pd.to_timedelta(std['new'])
Another solution is to convert the values ββto seconds by total_seconds , but this is less accurate:
dropped['new'] = dropped['diff'].dt.total_seconds() means = dropped.groupby('bank').mean()
source share