title: Merging or concat of multiple CSV files with a different number of columns and assigning a filename column
body: <p>Hi i am new to python pandas , and i am new doing code using dataframe . So i got a code from Internet on how to merge two or more csv file in a folder to one common csv file . but am not able get one line of code , i don't know how to do that . Can anyone help me in that please .</p>
  <pre><code>import os, glob
  import pandas as pd
  
  path = &quot;/home/user/data/&quot;
  
  all_files = glob.glob(os.path.join(path, &quot;data_*.csv&quot;))
  df_merged   = pd.concat(df_from_each_file, ignore_index=True)
  df_merged = (pd.read_csv(f, sep=',') for f in all_files)
  df_merged.to_csv( &quot;merged.csv&quot;)
  </code></pre>
  <p>so here i tried everything but am not able to get df_from_each_file . so can anyone help me in this
  and i want the output to be like this</p>
  <p><a href="https://i.stack.imgur.com/Eke4V.png" rel="nofollow noreferrer">So here is how my output should look like</a></p>