title: Read multiple csv files and Add filename as new column in pandas
body: <p>I have several csv files in a single folder and I want to open them all in one dataframe and insert a new column with the associated filename. So far I've coded the following:</p>
  
  <pre><code>import pandas as pd
  import glob, os
  df = pd.concat(map(pd.read_csv, glob.glob(os.path.join('path/*.csv'))))
  df['filename']= os.path.basename(csv)
  df
  </code></pre>
  
  <p>This gives me the dataframe I want but in the new column 'filename' it's only listing the last filename in the folder for every row. I'm looking for each row to be populated with it's associated csv file. Not just the last file in the folder. </p>
  
  <p>Any assistance for this newbie is much appreciated.</p>