2

When I output a pandas.DataFrame as a table in HDFStore:

import pandas as pd

df=pd.DataFrame({'A': [1, 2], 'B': [3, 4]}, index=range(2))
with pd.HDFStore("test.hdf5") as store:
    store.put("test", df, format="table")

I get the following layout when reading in ViTables: ViTables

I can correctly read it back with pandas.read_hdf(), but I find the data difficult to read: It's in these blocks, and the name of the columns is hidden by a values_block_0 label.

Is there a way to have a more intuitive layout in the HDF?

CharlesB
  • 86,532
  • 28
  • 194
  • 218

1 Answers1

1

Adding datacolumns=True in store.put() arguments gives a better layout:

ViTables

CharlesB
  • 86,532
  • 28
  • 194
  • 218