Pandas series mean and standard deviation
You can use list comprehension
with concat
and then mean
or std
.
For converting to float
(int
) add astype
, if still problem need to_numeric
with parameter errors='coerce'
.
s = pd.concat([pd.Series(x['A']) for x in data]).astype(float)print (s)0 2.01 3.02 4.03 5.04 6.00 7.01 11.02 90.03 43.04 87.0dtype: float64print (s.mean())25.8print (s.std())35.15299892375234
Another solution:
from itertools import chains = pd.Series(list(chain.from_iterable([x['A'] for x in data]))).astype(float)print (s)0 2.01 3.02 4.03 5.04 6.05 7.06 11.07 90.08 43.09 87.0dtype: float64