0

Hi can anyone please help me how to merge 200 same firmat data into one files in transpose into wide format. For example data1.xlsx containts ID, value data2.xlsx containts ID, value data3.xlsx containts ID, value . . . data200.xlsx containts ID, value

what I want Master data.xlsx that contains ID, VALUE 1, VALUE 2, VALUE 3... VALUE 200 Thank you

1 Answers1

0

You can use concat concat files and builtin module to find file like here

from os import listdir
from os.path import isfile, join
import pandas as pd

onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
files = []

for file in onlyfiles:
    files.append(pd.read_excel(file))

pd.concat(files).to_excel("data.xlsx")
Mickael
  • 24
  • 2