Pandas combine multiple csv files

后端 未结 3 815
北海茫月
北海茫月 2021-01-16 05:05

I have multiple csv files that I would like to combine into one df.

They are all in this general format, with two index columns:

                             


        
3条回答
  •  执念已碎
    2021-01-16 05:54

    I think you need concat instead merge:

    df = pd.concat([pd.read_csv(f, index_col=[0,1]) for f in files])
    

提交回复
热议问题