#数据分析 import pandas import csv old_path = r'd:2000W200W-400W.csv' f = open(old_path,'r',encoding='utf-8') data = pandas.read_csv(f) # print(data) num = int(data.describe().ix[0,0]) # print(num) # print(num) #遍历出所有行 # print("---------遍历出所有行-------") # for i in range(num): # record = data.ix[i,:] # print(record) # print(record['Name']) # print(record['CtfId']) # print(record['Mobile']) # print(record['EMail']) # print(record['Birthday']) new_path = r'd: .csv' new_file = open(new_path,'w',encoding='utf-8') writer = csv.writer(new_file) writer.writerow(('Name','CtfId','Mobile','EMail','Birthday')) for i in range(num): record = data.ix[i,:] Name = record['Name'] CtfId = record['CtfId'] Mobile = record['Mobile'] EMail = record['EMail'] Birthday = record['Birthday'] writer.writerow((record['Name'],record['CtfId'],record['Mobile'],record['EMail'],record['Birthday'])) print("保存完毕")