Store pandas DataFrame in PyTables table without saving index

In many functions of DataFrame.to_foo I can indicate that I do not want to write an index

 >>> help(df.to_csv) Write DataFrame to a comma-separated values (csv) file Parameters ---------- ... index : boolean, default True Write row names (index) ... 

Is there similar functionality for DataFrame.to_hdf ? I would not want to store the index in the PyTables table.

+1
source share
2 answers

You can turn to h5py and interact directly with HDF5.

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

Out-of-box index suppression using Pandas. The problem is tracked on

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

0
source

Source: https://habr.com/ru/post/974933/


All Articles