2017-07-18 69 views
1

当绘制与大熊猫下面seaborn值的CSV:seaborn地块空的白色平面

value  date  
0.296776 2016-07-01 
0.273482 2016-08-01 
0.207982 2016-09-01 
0.176148 2016-10-01 
0.124666 2016-11-01 
0.072311 2016-12-01 
0.042762 2017-01-01 
0.043232 2017-02-01 
0.083472 2017-03-01 

sns.tsplot(time="date", value="value", data=df)

我只能得到一个空的白色飞机 - 什么是错的?

回答

1

.tsplot的意思是,它意味着绘制时间序列以表示不确定性,所以如果您没有向DataFrame中的某个字段提供标识采样单元的字段,则不起作用。

要绕过这个不通过修改您的.csv数据集的麻烦去,你不应该使用data参数:

>>> sns.tsplot(df['value'],time=df['date']) 
<matplotlib.axes._subplots.AxesSubplot object at 0x07DA7A30> 
>>> sns.plt.show() 

enter image description here