问题现像:获取到的数据如图1,其中第一列保存进cvs文件中没有列名,得到的数据如图所示


解决:to_csv()函数中增加index参数,同时index_lable的值为列名
data.to_csv('00000103.csv',encoding='utf-8',index=True,index_label='tradedate')

问题现像:获取到的数据如图1,其中第一列保存进cvs文件中没有列名,得到的数据如图所示
解决:to_csv()函数中增加index参数,同时index_lable的值为列名
data.to_csv('00000103.csv',encoding='utf-8',index=True,index_label='tradedate')
本文标题:2021-02-22:python函数to_csv保存首列
本文链接:https://www.haomeiwen.com/subject/valhfltx.html
网友评论