antimatter.handlers.pandas_dataframe#

Module Contents#

Classes#

PandasDataFrame

The PandasDataFrame DataHandler supports a pandas DataFrame. There are

class antimatter.handlers.pandas_dataframe.PandasDataFrame#

Bases: antimatter.handlers.base.DataHandler

The PandasDataFrame DataHandler supports a pandas DataFrame. There are some restrictions on the underlying dataset which must be a two-dimensional data set, or a list of two-dimensional data sets.

from_generic(cols: List[str], generic_data: List[List[bytes]], extra: Dict[str, Any]) Any#

from_generic loads the generic data into a pandas DataFrame, passing any extra parameters transparently to the DataFrame constructor.

Parameters:
  • cols – the column names for the underlying data

  • generic_data – the data rows that are loaded into a pandas DataFrame

  • extra – extra data for the DataHandler, passed into the pandas DataFrame

Returns:

the pandas DataFrame built with the dataset

to_generic(df: Any) Tuple[List[str], List[List[bytes]], Dict[str, Any]]#

to_generic converts a pandas DataFrame into the generic data format, formatting the underlying data based on if the underlying data set is a list of two-dimensional records or a single two-dimensional record.

Parameters:

df – the DataFrame to extract generic format data from the underlying data set

Returns:

the data in its generic form