Python TypeError: resample() got an unexpected keyword argument ‘how‘

关注微信公共号:小程在线

关注****博客:程志伟的博客:

 

weather_2012['Temp (C)'].resample('M', how=np.median).plot(kind='bar')
Traceback (most recent call last):

  File "<ipython-input-26-59c50ec9a1b7>", line 1, in <module>
    weather_2012['Temp (C)'].resample('M', how=np.median).plot(kind='bar')

TypeError: resample() got an unexpected keyword argument 'how'

Python TypeError: resample() got an unexpected keyword argument ‘how‘

 

解决方法:

在resample()函数中how已经不再使用了,改成  .median()

weather_2012['Temp (C)'].resample('M').median().plot(kind='bar')

Python TypeError: resample() got an unexpected keyword argument ‘how‘

Python TypeError: resample() got an unexpected keyword argument ‘how‘