Pandas can’t read hdf5 file created with h5py

I’ve worked a little on the pytables module in pandas.io and from what I know pandas interaction with HDF files is limited to specific structures that pandas understands. To see what these look like, you can try

import pandas as pd
import numpy as np
pd.Series(np.zeros((3,5),dtype=np.float32).to_hdf('test.h5','test')

If you open ‘test.h5’ in HDFView, you will see a path /test with 4 items that are needed to recreate the DataFrame.

HDFView of test.h5

So I think your only option for reading in NumPy arrays is to read them in directly and then convert these to Pandas objects.

Leave a Comment