xpandas.data_container package

Submodules

xpandas.data_container.data_container module

class xpandas.data_container.data_container.XDataFrame(*args, **kwargs)[source]

Bases: pandas.core.frame.DataFrame

XDataFrame is 2d container that stores XSeries objects XDataFrame is an extension of pandas.DataFrame object

classmethod concat_dataframes(data_frames)[source]

Concatenate XDataFrame using pandas.concat method https://pandas.pydata.org/pandas-docs/stable/generated/pandas.concat.html over columns :param data_frames: list of XDataFrame instances :return: XDataFrame — concatenated list of data_frames

get_columns_of_type(column_type)[source]

Get all columns from XDataFrame with given column_type :param column_type: list of types or a single type :return: tuple. the first element is subMultiDataFrame and second is a list of column of a given column_type

get_data_types()[source]

Get a list of data_types of each XSeries inside XDataFrame :return: list of data_type

to_pandas_dataframe()[source]

Convert self to pandas.DataFrame if all columns are primitive types. See more at XSeries.to_pandas_series :return:

class xpandas.data_container.data_container.XSeries(*args, **kwargs)[source]

Bases: pandas.core.series.Series

XSeries is an homogeneous abstract 1d container that encapsulates any data type inside. It is an extension of pandas.Series class. XSeries has a property data_type that is a type ot objects that are inside XSeries.

apply(*args, **kwargs)[source]

Overwrite standart pandas.Series method. Apply transform function to all elements in self. If transform function return dict like object, transform XSeries to XDataFrame see XDataFrame constructor

Parameters:
  • func – function to apply
  • prefix – prefix for columns if needs to return XDataFrame object
Returns:

XSeries of XDataFrame depending on transformation

data_type

Getter for a data_type property data_type is a data type that self encapsulates For example, if self is contains images, that data_type would be Image

to_pandas_series()[source]

Convert self to pandas.Series if data_type is a primitive type etc. number of string :return: Pandas Series or raise exception if data_type is not a primitive type