【发布时间】:2020-03-03 01:51:17
【问题描述】:
我刚开始学习 pandas,当我想在创建 fig, ax = plt.subplots() 对象并将绘图添加到创建的 ax 时制作 2013 年站的平均值的条形图时,我在运行时遇到此错误这部分代码'Line2D'对象没有属性'kind'
fig,ax = plt.subplots(1)
x= data.columns
y=data['2013'].mean()
ax.plot(x,y,kind='bar')
```````````````````````
[this is my DATASET]
L06_347 LS06_347 LS06_348
Time
2009-01-01 00:00:00 0.137417 0.097500 0.016833
2009-01-01 03:00:00 0.131250 0.088833 0.016417
2009-01-01 06:00:00 0.113500 0.091250 0.016750
2009-01-01 09:00:00 0.135750 0.091500 0.016250
... ... ... ...
2013-01-01 15:00:00 1.420000 1.420000 0.096333
2013-01-01 18:00:00 1.178583 1.178583 0.083083
2013-01-01 21:00:00 0.898250 0.898250 0.077167
2013-01-02 00:00:00 0.860000 0.860000 0.075000
11697 rows × 3 columns
另一方面,我尝试使用此代码选择所有不同年份的 4 月、5 月和 6 月的所有数据
data[(data.index.month == 4) & (data.index.month == 5) & (data.index.month == 6)]
我也试过这种方式
data.loc[(data.index.month == 4) & (data.index.month == 5) & (data.index.month == 6)]
它什么也没显示,只是显示空列。
【问题讨论】: