I have 200 files of different which I need to concat column after column into one file. These 200 files are in one directory, and so I tried the following script.
path = '/data'
files = os.listdir(path)
files_txt = [os.path.join(path,i) for i in files if i.endswith('tsv')]
## Change it into dataframe
dfs = [pd.DataFrame.from_csv(x, sep='\t')[[6]] for x in files_txt]
##Concatenate it
merged = pd.concat(dfs, axis=1)
But it throws the follwoing value error as the shape is different for each of these files. I would to have some solution. Thank you
Here is error,
ValueError: Shape of passed values is (149, 13864), indices imply (149, 13860)