Lesson 32. Combining Multiple CSVs Into One File
Sure. You COULD write a bunch of loops and process files one at a time. Sometimes it is more efficient to create one file especially if you have a bunch of downstream processes that also operate on that data.
In that scenario, it is better to write one loop that combines all the CSVs into one big file. That way, no more loops have to be written.
Examples
Example #1: CONSTRUCTICONS! UNITE!!
We are going to take some small things and make them into a bigger thing.
We are going work with the files in the zip folder that we downloaded earlier. We are going to combine them and spit out the result into the CombineCSVExample folder.
We are also going to introduce a new way to loop over files and filter by file extension using the glob module. We will take the paths of all the files we want to combine and turn them into an iterable object that we can use the function enumerate on.
Once we are done, we do not need the original files so we can toss those.
This is also a long running process.
Last updated