Pandas HDF5 append time series fails -
going through documentation of pandas hdf5 usability (http://pandas.pydata.org/pandas-docs/stable/io.html#io-hdf5) given example raises error:
import pandas pd import numpy np store = pd.hdfstore('store.h5') np.random.seed(1234) index = pd.date_range('1/1/2000', periods=8) df = pd.dataframe(np.random.randn(8, 3), index=index) store['df'] = df df1 = df[0:4] df2 = df[4:] store.append('df', df1) store.append('df', df2) traceback (most recent call last): file "c:\anaconda3\lib\site-packages\ipython\core\interactiveshell.py", line 2885, in run_code exec(code_obj, self.user_global_ns, self.user_ns) file "<ipython-input-225-ef7f2e059c6a>", line 1, in <module> store.append('df', df1) file "c:\anaconda3\lib\site-packages\pandas\io\pytables.py", line 919, in append **kwargs) file "c:\anaconda3\lib\site-packages\pandas\io\pytables.py", line 1252, in _write_to_group raise valueerror('can append tables') valueerror: can append tables
has changed here? or doing wrong?
you need enable append
default store in table format setting following option @ beginning store behaves df
currently:
pd.set_option('io.hdf.default_format','table')
Comments
Post a Comment