[4
8
3
6]转入:
[6
3
8
4]Python将索引值0、1、2、3添加到dataframe,因此当我反转行时,索引值也会被标记,因此索引值为6、3、8、4为4、3、2、1。
问题是,当我绘制图时,图的排序不正确。所以,而不是获得:雅虎财务数据图
我得到:
Python输出图
发布于 2016-08-24 15:56:38
似乎reset_index可以解决这个问题:
df.iloc[::-1].reset_index(drop=True)df = pd.DataFrame({'A': [4, 8, 3, 6]})
df
Out:
A
0 4
1 8
2 3
3 6
df.iloc[::-1].reset_index(drop=True)
Out:
A
0 6
1 3
2 8
3 4https://stackoverflow.com/questions/39127900
复制相似问题