Skip to content

Hdf5/PyTables support for TimedeltaIndex #9635

Closed
@JonasAbernot

Description

@JonasAbernot

When stored in HDFStore, TimedeltaIndex are converted into Int64Index.

df = pd.DataFrame(np.random.normal(size=(10,5)))
df.index = pd.timedelta_range(start='0s',periods=10,freq='1s')
store = pd.HDFStore('test.h5')
store['df'] = df
df = store['df']
print df.index
Int64Index([0, 1000000000, 2000000000, 3000000000, 4000000000, 5000000000, 6000000000, 7000000000, 8000000000, 9000000000], dtype='int64')

Although the backward conversion is easy (pd.TimedeltaIndex(df.index)) , it's surprising.

pd.show_versions()
INSTALLED VERSIONS
------------------
commit: None
python: 2.7.6.final.0
python-bits: 64
OS: Linux
OS-release: 3.13.0-46-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: fr_FR.UTF-8

pandas: 0.15.2-269-ge3d1b0e
nose: 1.3.1
Cython: 0.20.1post0
numpy: 1.8.2
scipy: 0.13.3
statsmodels: None
IPython: 1.2.1
sphinx: 1.2.2
patsy: None
dateutil: 2.4.1
pytz: 2013b
bottleneck: None
tables: 3.1.1
numexpr: 2.2.2
matplotlib: 1.3.1
openpyxl: None
xlrd: None
xlwt: 0.7.5
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.999
httplib2: 0.8
apiclient: None
rpy2: None
sqlalchemy: 0.9.8
pymysql: None
psycopg2: None

I would have been happy to help and add this myself, but I really have no idea were is this hiding. I don't even know if I should have looked toward PyTables instead of here.

Thanks !

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugDtype ConversionsUnexpected or buggy dtype conversionsIO HDF5read_hdf, HDFStoreTimedeltaTimedelta data type

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions