Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

serialize pandas (python) dataframe to binary format

This post includes my question but is actually about another question: Pandas DataFrame serialization

Is there serialization routine like numpy.savez for pandas dataframes? I see I can use hdf5 but I was hoping to avoid this since hdf5 is an extra install and I haven't been able to get h5py up and running on all the platforms I need.

like image 703
mathtick Avatar asked Oct 20 '25 13:10

mathtick


2 Answers

Arg, DataMatrix is the same as DataFrame. There is a 'load' and a 'save' function that seems to work ... I guess the best way to search the docs is using the interactive prompt with ipython.

like image 93
mathtick Avatar answered Oct 22 '25 12:10

mathtick


Can you instead get PyTables (installation) working on all platforms relevant to you?

In that case you can use directly the HDFStore class in Pandas to serialize Panels and DataFrames, potentially with compression, to HDF5.

like image 37
meteore Avatar answered Oct 22 '25 10:10

meteore



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!