How to append .csv files with Python pandas

Srinevetha A R
Nov 12, 2020

Suppose you have a set of .csv files that you need to combine into one file, while keeping the header information.

Luckily, using the pandas package in Python, you can do this relatively easily.

In this example, you have two .csv files. homes.csv and homes1.csv

homes.csv

homes1.csv

How to append multiple .csv files with pandas

If you’d like to export the file as a new CSV, your code will look like this:

Resulting combined .csv file

homes_complete.csv

💭 Try it out yourself
💭 Click on the “CLAP” icon to exhibit how useful this post was to you
💭 Make sure to “FOLLOW” AND “COMMENT” to keep learning more programming or data science-related concepts with me.

--

--