title: Write pandas DataFrame to HDF in memory buffer
body: <p>I want to get a dataframe as hdf in memory.  The code below results in "AttributeError: '_io.BytesIO' object has no attribute 'put'".  I am using python 3.5 and pandas 0.17</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  import io
  
  df = pd.DataFrame(np.arange(8).reshape(-1, 2), columns=['a', 'b'])
  buf = io.BytesIO()
  df.to_hdf(buf, 'some_key')
  </code></pre>
  
  <p>Update:
  As UpSampler pointed out "path_or_buf" cannot be an io stream (which I find confusing since buf usually can be an io stream, see <a href="http://pandas.pydata.org/pandas-docs/version/0.17.0/generated/pandas.DataFrame.to_csv.html" rel="noreferrer">to_csv</a>).  Other than writing to disk and reading it back in, can I get a dataframe as hdf in memory?</p>