rle_array.autoconversion module¶
-
auto_convert_to_rle
(df: pandas.core.frame.DataFrame, threshold: Optional[float] = None) → pandas.core.frame.DataFrame¶ Auto-convert given DataFrame to RLE compressed DataFrame.
Important
Datetime columns are currently not compressed due to pandas not supporting them.
Please note that RLE can, under some circumstances, require MORE memory than the uncompressed data. It is not advisable to set
threshold
to a value larger than 1 except for testing purposes.- Parameters
df – Input DataFrame, may already contain RLE columns. This input data MIGHT not be copied!
threshold –
Compression threshold, e.g.:
None
: compress all1.0
compresses only if RLE does NOT take up more space0.5
compresses if at least 50% memory are safed0.0
do not compress at all
- Raises
ValueError – If threshold is negative.
-
decompress
(df: pandas.core.frame.DataFrame) → pandas.core.frame.DataFrame¶ Decompress all RLE columns in the provided DataFrame.
- Parameters
df – Input DataFrame. This input data MIGHT not be copied!