属性错误:模块'pandas'没有属性'ewma'


mte_exp_wighted_avg = pd.ewma(mte, halflife=12)
plt.plot(mte)
plt.plot(mte_exp_wighted_avg, color='red')
plt.xticks(fontsize = 25)
plt.yticks(fontsize = 25)
plt.xlabel('Years', fontsize = 25)
plt.ylabel('CO2 Emission', fontsize = 25)
plt.title('CO2 emission by coal power generation', fontsize = 25)
plt.show()

代码如上所示,熊猫升级了

错误显示在下方

Pandas的指数移动平均函数(ewma(自Pandas 0.19起已重命名为ewm。这只是更改一些名称的问题:

mte_exp_wighted_avg = pd.ewm(mte, halflife=12)
plt.plot(mte)
plt.plot(mte_exp_wighted_avg, color='red')
plt.xticks(fontsize = 25)
plt.yticks(fontsize = 25)
plt.xlabel('Years', fontsize = 25)
plt.ylabel('CO2 Emission', fontsize = 25)
plt.title('CO2 emission by coal power generation', fontsize = 25)
plt.show()

pd.ewma(mte,half-life=12(将不再工作
ewma已更改为ewm
mte_exp_wied_avg=mte.ewm(半衰期=12,最小周期=0,调整=True,忽略_na=False(.mean((

最新更新