Skip to content

BUG: IntervalIndex cannot be saved to HDF file #38305

Open
@twoertwein

Description

@twoertwein
  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


Code Sample, a copy-pastable example

import pandas as pd

data = pd.DataFrame({"a": [1]})
data.index = pd.IntervalIndex.from_arrays(
    [0.5],
    [0.9],
)

data.to_hdf('test.hdf', 'df')  # fails (as index)
data.reset_index().to_hdf('test.hdf', 'df')  # fails (as column)

Problem description

Pytables doesn't seems to know IntervalIndex. If pytables doesn't support IntervalIndex, pandas should either convert the IntervalIndex into two columns (and then merge them while reading) or throw an error early in to_hdf.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIO HDF5read_hdf, HDFStoreIntervalInterval data typeRegressionFunctionality that used to work in a prior pandas version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions