title: How to write a Pandas Dataframe into a HDF5 dataset
body: <p>I'm trying to write data from a Pandas dataframe into a nested hdf5 file, with multiple groups and datasets within each group. I'd like to keep it as a single file which will grow in the future on a daily basis. I've had a go with the following code, which shows the structure of what I'd like to achieve</p>
  <pre class="lang-py prettyprint-override"><code>import h5py
  import numpy as np
  import pandas as pd
  
  file = h5py.File('database.h5','w')
  
  d = {'one' : pd.Series([1., 2., 3.], index=['a', 'b', 'c']),
       'two' : pd.Series([1., 2., 3., 4.], index=['a', 'b', 'c', 'd'])}
  
  df = pd.DataFrame(d) 
          
  groups = ['A','B','C']         
          
  for m in groups:
      
      group = file.create_group(m)
      dataset = ['1','2','3']
  
      for n in dataset:
      
          data = df
          ds = group.create_dataset(m + n, data.shape)
          print (&quot;Dataset dataspace is&quot;, ds.shape)
          print (&quot;Dataset Numpy datatype is&quot;, ds.dtype)
          print (&quot;Dataset name is&quot;, ds.name)
          print (&quot;Dataset is a member of the group&quot;, ds.parent)
          print (&quot;Dataset was created in the file&quot;, ds.file)
                          
          print (&quot;Writing data...&quot;)
          ds[...] = data        
       
          print (&quot;Reading data back...&quot;)
          data_read = ds[...]
              
          print (&quot;Printing data...&quot;)
          print (data_read)
  
  file.close()
  </code></pre>
  <p>This way the nested structure is created but it loses the index and columns. I've tried the</p>
  <pre class="lang-py prettyprint-override"><code>df.to_hdf('database.h5', ds, table=True, mode='a')
  </code></pre>
  <p>but didn't work, I get this error</p>
  <blockquote>
  <p>AttributeError: 'Dataset' object has no attribute 'split'</p>
  </blockquote>
  <p>Can anyone shed some light please. Many thanks</p>