Skip to content Skip to sidebar Skip to footer

Store Pandas Dataframe In Pytables Table Without Storing Index

In many DataFrame.to_foo functions I can specify that I don't want to write the index >>> help(df.to_csv) Write DataFrame to a comma-separated values (csv) file Paramete

Solution 1:

You could call out to h5py and interact with HDF5 directly.

data = df.values
with h5py.File('data.h5','w') as f:
    f.create_dataset('my_table', data=data)

Solution 2:

Suppressing index is not out of the box with Pandas. The issue is tracked at

https://github.com/pydata/pandas/issues/8319

Post a Comment for "Store Pandas Dataframe In Pytables Table Without Storing Index"