Import multiple csv files into pandas and concatenate into one DataFrame

前端 未结 16 1803
既然无缘
既然无缘 2020-11-21 07:47

I would like to read several csv files from a directory into pandas and concatenate them into one big DataFrame. I have not been able to figure it out though. Here is what I

16条回答
  •  一个人的身影
    2020-11-21 08:09

    Easy and Fast

    Import two or more csv's without having to make a list of names.

    import glob
    
    df = pd.concat(map(pd.read_csv, glob.glob('data/*.csv')))
    

提交回复
热议问题