Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

read multiple csv files into separate dataframes python

import os

# current directory csv files
csvs = [x for x in os.listdir('.') if x.endswith('.csv')]
# stats.csv -> stats
fns = [os.path.splitext(os.path.basename(x))[0] for x in csvs]

d = {}
for i in range(len(fns)):
    d[fns[i]] = pd.read_csv(csvs[i])
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #read #multiple #csv #files #separate #dataframes #python
ADD COMMENT
Topic
Name
6+6 =