Python Dataframe对象没有属性

Python Dataframe对象没有属性,python,dataframe,matplotlib,jupyter-notebook,Python,Dataframe,Matplotlib,Jupyter Notebook,我下面的代码是每周平均数 df = information.groupby(pd.Grouper(freq='W')).mean('numbers') 当我打印这张照片的头部时,它就工作了 date numbers xx/xx/xxxx 4 xx/xx/xxxx 6 ... 但是我想把它打印成线图 plt.plot(df.date, df.numbers, data = df) 并获取错误 'DataFrame' object has no attribut

我下面的代码是每周平均数

df = information.groupby(pd.Grouper(freq='W')).mean('numbers')
当我打印这张照片的头部时,它就工作了

   date      numbers
xx/xx/xxxx     4
xx/xx/xxxx     6
...
但是我想把它打印成线图

plt.plot(df.date, df.numbers, data = df)
并获取错误

'DataFrame' object has no attribute 'date'
我现在意识到,当我做df.columns时,我

Index(['numbers'], dtype='object')

有人能解释一下这里发生了什么,以及我如何修改它,使日期和数字都成为数据框的一部分。

您确定“日期”是一列而不是索引吗?请尝试使用df.info()打印信息。它将提供所有信息,如列名及其数据类型,您可以从中选择正确的列名。
df=information.groupby(pd.Grouper(freq=“W”),as_index=False)。平均值(“数字”)
?要防止
date
字段成为索引,是否确定“date”是一列而不是索引?请尝试使用df.info()打印信息。它将提供所有信息,如列名及其数据类型,您可以从中选择正确的列名。
df=information.groupby(pd.Grouper(freq=“W”),as_index=False)。平均值(“数字”)
?防止
日期
字段成为索引。