python 拆分csv文件

 1 import pandas as pd
 2 
 3 data = pd.read_csv(r'文件路径', encoding='gbk')
 4 print('running')
 5 
 6 for i in range(0, 10):
 7     save_data = data.iloc[i*200000:(i+1)*200000]
 8     file_name = r'输出路径文件_' + str(i) + '.csv'
 9     print(str(i)+'ok')
10     save_data.to_csv(file_name, index=False, encoding='gbk')

 

posted @ 2021-04-26 17:05  深海的石头  阅读(305)  评论(0编辑  收藏  举报