I have 10 csv files, named data_run1_all.csv
, data_run2_all.csv
, ..., data_run10_all.csv
. CSV files have same columns, but different rows.
Now I am importing them one by one to df_run1
, df_run2
, ..., df_run10
.
Can I use a loop to import them? Something like: i=1 to 10, df_runi=pandas.read_csv('data_runi_all.csv')
.
I am asking because the data analysis, plotting, etc. for each data frame are same, too. All the code for each data frame is repeated 10 times. If I can use a loop to do 10 times, the code will be much shorter and readable.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…