title: How to read multiple files from a directory and append them in python?
body: <p>Iam working with files in a folder where i need better way to loop through files and append a column to make master file. For two files i was using reading as two dataframe and appending series. However now i ran into situation with more more than 100 files.
  file 1 is as below:</p>
  <pre><code>Num Department  Product Salesman    Location         rating1
  1   Electronics TV      3           Bigmart, Delhi      5
  2   Electronics TV      1           Bigmart, Mumbai     4
  3   Electronics TV      2           Bigmart, Bihar      3
  4   Electronics TV      2           Bigmart, Chandigarh 5
  5   Electronics Camera  2           Bigmart, Jharkhand  5
  
  similary file 2:
   Num    Department  Product  Salesman       Location               rating2
    1      Electronics    TV      3           Bigmart, Delhi          2
    2      Electronics    TV      1           Bigmart, Mumbai         4
    3      Electronics    TV      2           Bigmart, Bihar          4
    4      Electronics    TV      2           Bigmart, Chandigarh     5
    5      Electronics    Camera  2           Bigmart, Jharkhand      3
  </code></pre>
  <p>What I am trying to achieve is read Rating column from all the other file and append verticaly. Expected:</p>
  <pre><code> Num    Department  Product Salesman    Location          rating1   rating2
    1     Electronics TV      3           Bigmart, Delhi      5         2
    2     Electronics TV      1           Bigmart, Mumbai     4         4
    3     Electronics TV      2           Bigmart, Bihar      3         5
    4     Electronics TV      2           Bigmart, Chandigarh 5         5
    5     Electronics Camera  2           Bigmart, Jharkhand  5         3
  </code></pre>
  <p>I modified some of the code posted here. Following Code worked:</p>
  <pre><code>def read_folder(folder):
      files = [i for i in os.listdir(folder) if 'xlsx' in i]
      df = pd.read_excel(folder+'/{}'.format(files[0]))
      for f in files[1:]:
          df2 = pd.read_excel(folder+'/{}'.format(f))
           df = df.merge(df2.iloc[:,5],left_index=True,right_index=True)   
      return df
  </code></pre>