December 2018
Beginner to intermediate
682 pages
18h 1m
English
It is possible to read all files from a particular directory into DataFrames without knowing their names. Python provides a few ways to iterate through directories, with the glob module being a popular choice. The gas prices directory contains five different CSV files, each having weekly prices of a particular grade of gas beginning from 2007. Each file has just two columns--the date for the week and the price. This is a perfect situation to iterate through all the files, read them into DataFrames, and combine them all together with the concat function. The glob module has the glob function, which takes a single parameter--the location of the directory you would like to iterate through as a string. To get all the files in ...