无法绘制来自pandas.core.frame.DataFrame的日期;产生ValueError

时间:2018-07-29 13:28:12

标签: python python-3.x pandas matplotlib

我目前正在尝试jupyterlab(python 3),随着时间的推移,我在从csv文件中绘制数据时遇到了问题。我用以下内容启动笔记本:

%matplotlib inline
import matplotlib as plt
import pandas as pd

我有一个csv文件,看起来像这样:

Accessory: Eve Weather,
Room: outside,
Home: My Home,
Date,Temperature (Celsius)
2018-07-24T20:45:31,28.86
2018-07-24T20:35:31,29.06
2018-07-24T20:25:31,29.19
2018-07-24T20:15:32,29.31
2018-07-24T20:05:31,29.48
2018-07-24T19:55:31,29.58
2018-07-24T19:45:31,29.82
2018-07-24T19:35:32,30.32
2018-07-24T19:25:31,31.00

我这样导入它:

df=pd.read_csv("somefile.csv", sep=',' , header = 3, usecols=[0, 1], parse_dates=[0], infer_datetime_format=True)

现在我想绘制它。但是如何?我尝试过:

df.plot()

如建议的here,但这会引发以下错误:

ValueError: view limit minimum -36812.62671585647 is less than 1 and is an invalid Matplotlib date value. This often happens if you pass a non-datetime value to an axis that has datetime units

使用jupyter笔记本时也会发生错误。我正在使用Anaconda。

0 个答案:

没有答案