我有以下数据框:
Month
1 -0.075844
2 -0.089111
3 0.042705
4 0.002147
5 -0.010528
6 0.109443
7 0.198334
8 0.209830
9 0.075139
10 -0.062405
11 -0.211774
12 -0.109167
1 -0.075844
2 -0.089111
3 0.042705
4 0.002147
5 -0.010528
6 0.109443
7 0.198334
8 0.209830
9 0.075139
10 -0.062405
11 -0.211774
12 -0.109167
Name: Passengers, dtype: float64
如您所见,数字从 1-12 / 1-12 列出了两次,相反,我想将索引更改为 1-24。问题是,在绘制它时,我看到以下内容:
plt.figure(figsize=(15,5))
plt.plot(esta2,color='orange')
plt.show()
我想看到从 1 到 24 的连续线。
esta2 = esta2.reset_index()
会给你0-23。如果你需要 1-24 那么你可以做esta2.index = np.arange(1, len(esta2) + 1)
.
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句