title: How to concatenate multiple csv files into one based on column names without having to type every column header in code
body: <p>I am relatively new to python (about a weeks experience) and I can't seem to find the answer to my problem.</p>
  
  <p>I am trying to merge hundreds of csv files based in my folder Data into a single csv file based on column name.</p>
  
  <p>The solutions I have found require me to type out either each file name or column headers which would take days.</p>
  
  <p>I used this code to create one csv file but the column names move around and therefore the data is not in the same columns over the whole DataFrame:</p>
  
  <pre><code>import pandas as pd
  import glob
  import os
  def concatenate(indir=r"C:\\Users\ge\Documents\d\de", 
  outfile = r"C:\Users\ge\Documents\d"):
      os.chdir(indir)
      fileList=glob.glob("*.csv")
      dfList = []
      for filename in fileList:
          print(filename)
          df = pd.read_csv(filename, header = None)
          dfList.append(df)
          concatDf = pd.concat(dfList, axis = 0)
      concatDf.to_csv(outfile, index= None)
  </code></pre>
  
  <p>Is there quick fire method to do this as I have less than a week to run statistics on the dataset.</p>
  
  <p>Any help would be appreciated.</p>