我的简单代码:
import pandas as pd
df = pd.DataFrame('data')
print(type(df))
print(df.columns)
print(df.head())
输出:
<class 'pandas.core.frame.DataFrame'>
Index(['Value'], dtype='object')
Value
Date
2010-03-31 965.95
2010-04-01 974.99
2010-04-06 963.82
2010-04-07 968.23
2010-04-08 972.51
我的问题是,如何访问Date列?我想将它用于matplot Y轴:
from matplotlib import pyplot as plt
plt.scatter(x, y = df['Date']))
问题是,我无法访问它。感谢