# -*- coding: utf-8 -*- import pandas as pd import numpy as np import re import os df = pd.read_csv("1230.csv") new_l = list(df.columns) new_l.pop(0) hash_table = dict() for i in new_l: number_i = re.findall('i.*?.',i)[0] hash_table[number_i[1:-1]] = i # d128i int_l = list(map(int,list(hash_table.keys()))) hash_table['8'] = 'd8i128.txt' df_new = pd.Dataframe(np.array(df.iloc[:,0])) i = 0 len_l = len(int_l) while i < len_l: mini = min(int_l) int_l.pop(int_l.index(mini)) i += 1 df_new = pd.concat([df_new, pd.Dataframe({hash_table[str(mini)]:np.array(df[hash_table[str(mini)]])})],axis=1) df_new.to_csv('sortted_i.csv',index=False) print("文件已经被保存到{}".format(os.getcwd()+'sortted_i.csv'))
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)