Created
May 7, 2021 17:44
-
-
Save ahmedshahriar/da680d40091fa2857b6d1c8f68fdd821 to your computer and use it in GitHub Desktop.
Merge multiple CSV files with identical columns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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