我有200個不同的文件,我需要逐列合并到一個文件中。這200個文件位于一個目錄中,因此我嘗試了以下腳本。path = '/data' files = os.listdir(path)files_txt = [os.path.join(path,i) for i in files if i.endswith('tsv')]## Change it into dataframedfs = [pd.DataFrame.from_csv(x, sep='\t')[[6]] for x in files_txt]##Concatenate itmerged = pd.concat(dfs, axis=1)但是,由于這些文件的形狀不同,因此會引發以下值錯誤。我將有一些解決方案。謝謝這是錯誤ValueError: Shape of passed values is (149, 13864), indices imply (149, 13860)
添加回答
舉報
0/150
提交
取消
