How to get the list of CSV files contained in a folder in Python
Land Your First Data Science Job
A proven roadmap to prepare for $75K+ entry-level data roles. Perfect for Data Scientist ready to level up their career.
You might end up one day in a situation that will require you to aggregate data.
By example, some sales reports for which you will probably need to do some comparative analysis between years/months.
and you'll end up with a folder full of CSV files.
In order to retrieve all those CSV files here is a method I used most of the time utilizing a list comprehension.
Then you can iterate over this list, read the data and perform more specific operations.
More on DataFrames
If you want to know more about DataFrame and Pandas. Check out the other articles I wrote on the topic, just here :
Land Your First Data Science Job
A proven roadmap to prepare for $75K+ entry-level data roles. Perfect for Data Scientist ready to level up their career.
Related Articles
Continue your learning journey with these related topics
Master Data Science in Days, Not Months 🚀
Skip the theoretical rabbit holes. Get practical data science skills delivered in bite-sized lessons – Approach used by real data scientist. Not bookworms. 📚