Merging csv files but the files may have different column names

30 Views Asked by At

I wish to combine csv files into one dataset. Each file has a different column name. How do I change the column names to a standard one and merge them.

if all the columns names in the file were standard, I could use a list comprehension to combine them:

df = pd.concat(pd.read('list', usecols=['col1','col2','col3'])
    for list in glob.glob('data/data*.csv')

but my datasets have different column names.

0

There are 0 best solutions below