This is the exact python analogue of the following Spark question:
I am reading in a wildcard list of parquet files using (variously) pandas and awswrangler.
Is there a way to retrieve a column containing the original filename of each row loaded into the eventual combined dataframe, exactly as per the Spark version of this quesiton?
Update: This is possibly a way to do it - Reading DataFrames saved as parquet with pyarrow, save filenames in columns
Update2: The present question is the reverse of https://stackoverflow.com/a/59682461/1021819
You'll need to add the filename as a new column to each dataframe as you load them. For example, here is how to do this with a set of CSV files since that is easier to run as an example. You'll follow a similar pattern for parquet files.