Мой фрейм данных
Здесь я хочу стандартное отклонение для указанного выше кадра данных и мне нужен график стандартных отклонений.
Я использовал ниже код
import numpy as np
import scipy.stats as stats
import pylab as pl
import pandas as pd
h=pd.read_excel(r"C:\Users\monthlyReports\standard_deviation\stan_rawdata.xlsx")
fit = stats.norm.pdf(h, np.mean(h), np.std(h))
pl.plot(h,fit,'-o')
pl.hist(h,normed=True)
pl.show()
но я получаю ошибку типа:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-830c3a5f6c7c> in <module>()
7
8
----> 9 fit = stats.norm.pdf(h, np.mean(h), np.std(h)) #this is a fitting indeed
10
11 pl.plot(h,fit,'-o')
~\AppData\Local\Continuum\anaconda3\lib\sitepackages\scipy\stats\_distn_infrastructure.py in pdf(self, x, *args, **kwds)
1650 args = tuple(map(asarray, args))
1651 dtyp = np.find_common_type([x.dtype, np.float64], [])
-> 1652 x = np.asarray((x - loc)/scale, dtype=dtyp)
1653 cond0 = self._argcheck(*args) & (scale > 0)
1654 cond1 = self._support_mask(x) & (scale > 0)
TypeError: unsupported operand type(s) for -: 'str' and 'float'