问题遇到的现象和发生背景
导入数据的时候(第一次提问,不知道这样提问合不合适,还请多多见谅)
问题相关代码
f=open('D:\\高频数据.csv')
df=pd.read_csv(f) #读入数据
df['label'] = df.deal.shift()
data=df.iloc[1:,[1,2]].values
运行结果及报错内容
AttributeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_11460/103785512.py in <module>
2 f=open('D:\\高频数据.csv')
3 df=pd.read_csv(f)
----> 4 df['label'] = df.deal.shift()
5 data=df.iloc[1:,[1,2]].values
~\anaconda3\envs\TF2.1\lib\site-packages\pandas\core\generic.py in __getattr__(self, name)
5485 ):
5486 return self[name]
-> 5487 return object.__getattribute__(self, name)
5488
5489 def __setattr__(self, name: str, value) -> None:
AttributeError: 'DataFrame' object has no attribute 'deal'