Last active
April 24, 2020 00:53
-
-
Save bigsnarfdude/dcbf8e1e1c37f8506178831bbef5a185 to your computer and use it in GitHub Desktop.
pandas concat multiple files
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 | |
from glob import glob | |
raw_files = sorted(glob('files*.csv')) | |
pd.concat((pd.read_csv(singleFile).assign(filename=singleFile) for singleFile in raw_files), ignore_index=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment