Skip to content

Instantly share code, notes, and snippets.

@ahmedshahriar
Created May 7, 2021 17:44
Show Gist options
  • Save ahmedshahriar/da680d40091fa2857b6d1c8f68fdd821 to your computer and use it in GitHub Desktop.
Save ahmedshahriar/da680d40091fa2857b6d1c8f68fdd821 to your computer and use it in GitHub Desktop.
Merge multiple CSV files with identical columns
import pandas as pd
import glob
path = r'C:\DRO\DCL_rawdata_files' # use your path
all_files = glob.glob(path + "/*.csv")
li = []
for filename in all_files:
df = pd.read_csv(filename, index_col=None, header=0) # to keep a single header
li.append(df)
frame = pd.concat(li, axis=0, ignore_index=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment