title: How to take mean,std and mad of multiple dataframes that are appended in a list?
body: <p>I've several hundred dataframes that are appended in a list. All the dataframes have same number of columns but the number of rows are not same. The column names are also same.  </p>
  
  <p>So i want to take the mean, mad, std of column value of each column and i'm doing something like this:</p>
  
  <p>All the dataframes are appended in a list (lst)</p>
  
  <pre><code>lst = []
  
  
  for filen, filen1 in zip(filelistn, filelist1):
     df1 = pd.read_table(path_to_files+filen, skiprows=0, usecols=(0,1,2,3,4,8),names=['wave','num','stlines','fwhm','EWs','MeasredWave'],delimiter=r'\s+')
     df2 = pd.read_table(path_to_files1+filen1, skiprows=0, usecols=(0,1,2,3,4,8),names=['wave','num','stlines','fwhm','EWs','MeasredWave'],delimiter=r'\s+')
  
     dfs = pd.merge(df1,df2, on='wave', how='inner')
     dfs = df1 - df2
     lst.append(dfs)
  
  df = reduce(lambda x, y: pd.merge(x, y, on = 'wave',how='outer'), lst)
  df = df.rename(columns = lambda x: x.split('_')[0]).T 
  df = df.groupby(df.index).agg(['mean','std','mad','median']).T
  </code></pre>
  
  <p>But the results that i'm getting are a bit weird, Like in column <code>mad</code> there are values like <code>21,65,36</code> which is absurd.</p>
  
  <pre><code>        wave       mean    median        mad
  0    4050.32  -0.016182 -0.011940   0.008885
  1    4208.98   0.023707  0.007189   0.032585
  2    4374.94  -0.001321 -0.001196   0.000378
  3    4379.74   0.002778  0.003380   0.004685
  4    6828.60 -10.604568 -0.000590  21.084799
  5    6839.84  -0.003466 -0.001870   0.010169
  6    6842.04 -32.751551 -0.002514  65.118329
  7    6842.69  18.293519 -0.002158  36.385884
  </code></pre>
  
  <p>The column <code>wave</code> is same in all the dataframes, but the number of rows are not. Does it has anything to do with that? May be it's taking the mean of the wrong rows?</p>
  
  <p>Can anyone tell me how to solve this?</p>