Add filename column using pandas | Python in finance #4

Example of the automated process

Data can be found: here

You create a for loop and perform the following manipulations per file:

  • Read in the file
  • Create a new column and assign the file name
  • Create a date column based on the filename
  • Append the file to a consolidated dataframe

Happy programming!

Cheers,

Ewoud

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store