title: How to save and retrive Pandas dataframes with hierarchichal indexing?
body: <p>I need to created and save a Pandas dataframe with hierarchical indexing. In the following I create two dataframes, and then concatenate them to create a new dataframe with hierarchical index. </p>
  
  <pre><code>data1 = np.random.rand(5,5)
  data2 = np.random.rand(5,5)
  df1 = pd.DataFrame(data1, columns = ['a', 'b', 'c', 'd', 'e'],  index=['i1', 'i2', 'i3', 'i4', 'i5'])
  df2 = pd.DataFrame(data2, columns = ['a', 'b', 'c', 'd', 'e'],  index=['i1', 'i2', 'i3', 'i4', 'i5'])
  
  df = pd.concat([df1, df2], keys=['first', 'second'])
  
  print "Original Data frame"
  print df
  
  # Save to file.
  df.to_csv('test')
  
  # Read from file.
  df_new = pd.DataFrame.from_csv('test')
  
  print "Saved Data frame"
  print df_new
  </code></pre>
  
  <p>Here is output that I get,</p>
  
  <pre><code>Original Data frame
                    a         b         c         d         e
  first  i1  0.926553  0.180306  0.182887  0.783061  0.832914
         i2  0.899054  0.130367  0.615534  0.965580  0.669495
         i3  0.931004  0.425528  0.068938  0.166522  0.714399
         i4  0.082365  0.587194  0.993864  0.187864  0.066035
         i5  0.668671  0.294744  0.136317  0.358732  0.529674
  second i1  0.916310  0.361423  0.700380  0.386119  0.273667
         i2  0.102542  0.454106  0.565760  0.259323  0.104743
         i3  0.410280  0.379986  0.288921  0.177819  0.919343
         i4  0.447279  0.113711  0.032273  0.335358  0.717824
         i5  0.995781  0.356817  0.146785  0.972401  0.169360
  
  Saved Data frame
         Unnamed: 1         a         b         c         d         e
  first          i1  0.926553  0.180306  0.182887  0.783061  0.832914
  first          i2  0.899054  0.130367  0.615534  0.965580  0.669495
  first          i3  0.931004  0.425528  0.068938  0.166522  0.714399
  first          i4  0.082365  0.587194  0.993864  0.187864  0.066035
  first          i5  0.668671  0.294744  0.136317  0.358732  0.529674
  second         i1  0.916310  0.361423  0.700380  0.386119  0.273667
  second         i2  0.102542  0.454106  0.565760  0.259323  0.104743
  second         i3  0.410280  0.379986  0.288921  0.177819  0.919343
  second         i4  0.447279  0.113711  0.032273  0.335358  0.717824
  second         i5  0.995781  0.356817  0.146785  0.972401  0.169360
  </code></pre>
  
  <p>When I save this new dataframe to a csv file ('test') and read it back, I loose the hierarchical indexing. Is there a way to save the data into a file, such that when I read it back, I retain the hierarchical indexing?</p>