【发布时间】:2018-01-16 20:33:11
【问题描述】:
【问题讨论】:
【问题讨论】:
您只需要绘图列A,索引用于x,y 的值默认用于Series.plot:
#line is default method, so omitted
Test['A'].plot(style='o')
另一种解决方案是reset_index 来自index 的列,然后是DataFrame.plot:
Test.reset_index().plot(x='index', y='A', style='o')
示例:
Test=pd.DataFrame({'A':[3.0,4,5,10], 'B':[3.0,4,5,9]})
print (Test)
A B
0 3.0 3.0
1 4.0 4.0
2 5.0 5.0
3 10.0 9.0
Test['A'].plot(style='o')
print (Test.reset_index())
index A B
0 0 3.0 3.0
1 1 4.0 4.0
2 2 5.0 5.0
3 3 10.0 9.0
Test.reset_index().plot(x='index', y='A', style='o')
【讨论】:
ax = Test['A'].plot(style='o') ax.set_ylim(0,10) - 见here