我对数据帧有这种要求,我想将所有df导出到多个csv文件:
print(final)
'Prod': Timestamp Flag group
0 2019-10-21 07:39:28.052763 begin Prod
1 2019-10-21 07:39:58.332252 end Prod
2 2019-10-21 07:40:00.279654 begin Prod
3 2019-10-21 07:41:58.631835 end Prod
4 2019-10-21 07:42:54.243338 begin Prod
[5354 rows x 3 columns],
'Clean': Timestamp Flag group
0 2019-10-21 07:48:26.740378 begin Clean
1 2019-10-21 07:48:28.272688 end Clean
2 2019-10-21 07:48:37.306045 begin Clean
3 2019-10-21 07:48:41.689466 end Clean
4 2019-10-21 08:32:46.240015 begin Clean
所以我尝试了这个,但是它不起作用,我认为问题出在“ filename = ...”行中。
for key in final.keys():
filename = [key]+"/*.csv"
final[key].to_csv(filename, sep = ',' , encoding = 'utf-8', index = False)
出于数据科学目的,我需要这个。感谢您的帮助。