这在以下情况下不受支持fixed
使用多索引时的格式。我想可能应该提高我想的未实施的程度。这是一个要跟踪的问题this https://github.com/pydata/pandas/issues/7775
请参阅完整 hdf5 接口文档here http://pandas.pydata.org/pandas-docs/stable/io.html#hdf5-pytables
In [11]: pd.read_hdf('/tmp/my.h5', 'data').index.levels[0]
Out[11]:
<class 'pandas.tseries.index.DatetimeIndex'>
[2000-01-01 05:00:00, 2000-01-02 05:00:00]
Length: 2, Freq: None, Timezone: None
但如果你指定table
格式化它可以工作。
In [13]: df.to_hdf('/tmp/my.h5', 'data2', format='table')
In [14]: pd.read_hdf('/tmp/my.h5', 'data2')
Out[14]:
a
2000-01-01 00:00:00-05:00 2000-01-02 00:00:00-05:00 0
2000-01-02 00:00:00-05:00 2000-01-03 00:00:00-05:00 0
In [15]: pd.read_hdf('/tmp/my.h5', 'data2').index.levels[0]
Out[15]:
<class 'pandas.tseries.index.DatetimeIndex'>
[2000-01-01 00:00:00-05:00, 2000-01-02 00:00:00-05:00]
Length: 2, Freq: None, Timezone: EST5EDT
In [16]: pd.read_hdf('/tmp/my.h5', 'data2').index.levels[1]
Out[16]:
<class 'pandas.tseries.index.DatetimeIndex'>
[2000-01-02 00:00:00-05:00, 2000-01-03 00:00:00-05:00]
Length: 2, Freq: None, Timezone: EST5EDT