title: Preserve row order when doing operations across multiple dataframes in Pandas
body: <p>I am generating a lot of correlation dataframes in Pandas. They all have the same shape and format. So here is dataframe A:-</p>
  
  <pre><code>             free_memory       memory_in_use     active_memory
  free_memory     1               0.190912742      0.375301656
  memory_in_use   0.190912742     1                0.962653384
  active_memory   0.375301656     0.962653384      1
  </code></pre>
  
  <p>and this is dataframe B:-</p>
  
  <pre><code>                free_memory         memory_in_use   active_memory
  free_memory     1                   0.673434243     0.712713697
  memory_in_use   0.673434243         1               0.991687459
  active_memory   0.712713697         0.991687459     1
  </code></pre>
  
  <p>When I get a dataframe C such that all of its cells are mean of corresponding cells in A and B, Pandas mixes up the order of the rows. For example the result C looks like this:-</p>
  
  <pre><code>                  free memory  memory in use  active memory
  active memory     0.296996       0.960049       1.000000
  free memory       1.000000       0.520667       0.296996
  memory in use     0.520667       1.000000       0.960049
  </code></pre>
  
  <p>As you can see, column order is preserved but row order is effed up and I dont get the nice diagonal 1's. How can I keep the order same as in the input dataframes? The relevant code that is doing this is:-</p>
  
  <pre><code>df_concat.groupby(df_concat.index).mean()
  </code></pre>