首次发布,Python新手,感谢您的帮助和耐心。寻找帮助迭代read_csv()文件并将每个文件分配给他们自己的新数据帧。 '文件名'正确引入,只是为导入的每个csv创建一个唯一的数据帧。
#makes a variable list of filenames with common patterns via glob
filenames = sorted(glob.glob('617*.txt'))
#gets the number of files from folder
count = len(filenames)
i =0
for i in range(0, count):
file = pd.read_csv('C:/Users/fjehlik/Desktop/python\
data_frame_excel/'+filenames[i], sep = '\t', header=0)
答案 0 :(得分:0)
IIUC您要创建DataFrames字典:
dfs = {f:pd.read_csv(f, sep='\t') for f in filenames}