如何创建Pandas DataFrame格式

想用mplfinance绘制K线图,已经有股票的csv表,但就是报错,说TypeError: Expect data.index as DatetimeIndex
我已经卡在这里两个小时了,到底怎样才能转过来啊,我真的不会啊

img

img

img

一、你要把‘Date’设置为索引
df.set_index('Date',inplace=True)
二、要把时间戳转换为数据中的日期时间对象
df = df.rename(index=pd.Timestamp)
建议您不要用mplfinance画k线图,这个效率太低了。pyqtgraph这个速度非常快