def df_to_msgpack(df, filename):
df.to_msgpack(filename, default=decimal_default)
The function above stores the DF to messagepack file. Now, I want to read the file and store it in the DF for further calculation. How can it be done?
with open(filename, 'rb') as data_file:
data_loaded = msgpack.unpackb(data_file.read())
I tried the solution above and it didn't help.
msgpack_read(filename)
The solution also only reads the file. Any solution?
You can use pandas.read_msgpack
although it still is an experimental version in ver0.23.4
.
df = pd.read_msgpack(filename)