我正在使用包tushare
(https://pypi.org/project/tushare/)获取中国股市数据。它返回日期框数据,其中包括date
列,我想使用这个date
作为索引
当我在shell中使用它时,它就工作了。但是当我在函数中使用它时,它会给出一个错误'DataFrame' object has no attribute "date"
。为什么会发生这种情况
df = ts.get_k_data(code=code,ktype='D', autype='qfq', start=start)
df.index=pd.to_datetime(df.date)
AttributeError: 'DataFrame' object has no attribute 'trade_date'
目前没有回答
相关问题 更多 >
编程相关推荐