更新时间:2022-12-08 22:59:06
日期"
列 df [col]
f'{col} .csv'
,其中 col
是列名.'Date'
columndf[col]
f'{col}.csv'
, where col
is the column name. df.to_csv(os.getcwd()+'\\ file.csv')
进入 AppData
文件夹'c:/Users/<< user_name>>/Documents/{col} .csv'
.df.to_csv(os.getcwd()+'\\file.csv')
goes into the AppData
folder'c:/Users/<<user_name>>/Documents/{col}.csv'
, for example.import pandas as pd
# set Date as the index
df.set_index('Date', inplace=True)
# iterate through each column and save it
for col in df.columns:
df[col].to_csv(f'c:/Users/<<user_name>>/Documents/{col}.csv', index=True)