Closed
Description
Feature Type
-
Adding new functionality to pandas
-
Changing existing functionality in pandas
-
Removing existing functionality in pandas
Problem Description
I wish I could use pandas to save dataframe with maximum possible compression. xz is good, but no way now to set preset=9
Feature Description
level = 9
df.to_pickle("name.pkl.xz", compression={'method': 'xz', 'compresslevel': level})
or
df.to_pickle("name.pkl.xz", compression={'method': 'xz', 'preset': level})
in /lib/python3.8/site-packages/pandas/io/common.py 828:
elif compression == "xz":
if ioargs.mode=='rb':
handle = get_lzma_file()(handle, ioargs.mode) # type: ignore[arg-type]
else:
handle = get_lzma_file()(handle, ioargs.mode, preset=level)
Alternative Solutions
Other methods compression in pandas support compresslevel
Additional Context
No response