从.csv文件读取DataFrame,无法识别列

时间:2019-06-11 07:13:47

标签: python pandas csv dataframe series

我正在使用以下代码将数据从this csv file导入到熊猫DataFrame中。而且我希望获得Series数据,但是却收到错误消息。

df = pd.read_csv('../../data/gen/the_file.csv'.format(symbol),
                 parse_dates=True,
                 index_col=0)
df.info()

close_series = df.close
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 392 entries, 2017-06-12 to 2018-12-31
Data columns (total 12 columns):
close                    392 non-null float64
high                     392 non-null float64
low                      392 non-null float64
p_change                 392 non-null float64
open                     392 non-null float64
pre_close                392 non-null float64
volume                   392 non-null int64
date                     392 non-null int64
date_week                392 non-null int64
key                      392 non-null int64
atr21                    392 non-null float64
atr14                    392 non-null float64
dtypes: float64(8), int64(4)
memory usage: 39.8 KB

AttributeError: 'DataFrame' object has no attribute 'close'

非常感谢您的帮助!谢谢!

0 个答案:

没有答案