deepcave.utils.compression

# Compression

This module provides utilities for serializing and deserializing a dataframe from/to a string.

## Classes
  • Encoder: This class defines a custom JSON Encoder.

## Constants
  • JSON_DENSE_SEPARATORS: Tuple(str, str)

  • JSON_DEFAULT_SEPARATORS: Tuple(str, str)

  • TYPE: TypeVar

Functions

deserialize(string[, dtype])

Deserialize a dataframe from a string.

serialize(data)

Serialize a dataframe to a string.

deepcave.utils.compression.deserialize(string, dtype=<class 'pandas.core.frame.DataFrame'>)[source]

Deserialize a dataframe from a string.

Parameters:
  • string (str) – The string to be deserialized.

  • dtype (TYPE, optional) – The type of the object. Default is pd.DataFrame.

Returns:

The deserialized object.

Return type:

TYPE

deepcave.utils.compression.serialize(data)[source]

Serialize a dataframe to a string.

Parameters:

data (Union[Dict, List, pd.DataFrame]) – The dataframe to be serialized.

Returns:

The serialized object as a JSON formatted string.

Return type:

str