pandas_domains#

Domains for Pandas datatypes.

Data#

PandasColumnsDescriptor#

Mapping from column name to column domain.

Classes#

PandasSeriesDomain

Domain of Pandas Series.

PandasDataFrameDomain

Domain of Pandas DataFrames.

class PandasSeriesDomain#

Bases: tmlt.core.domains.base.Domain

Domain of Pandas Series.

Note

The index is always ignored when this domain type is used.

element_domain :tmlt.core.domains.numpy_domains.NumpyDomain#

Domain of elements in the Series.

property carrier_type#

Returns carrier type for members of the domain.

Return type

type

validate(value)#

Raises error if value is not a DataFrame with matching schema.

Parameters

value (Any) –

Return type

None

classmethod from_numpy_type(dtype)#

Returns a Pandas Series from a NumPy type.

Parameters

dtype (numpy.dtype) –

Return type

PandasSeriesDomain

__contains__(value)#

Returns True if value is in the domain.

Parameters

value (Any) –

Return type

bool

class PandasDataFrameDomain(schema)#

Bases: tmlt.core.domains.base.Domain

Domain of Pandas DataFrames.

Parameters

schema (PandasColumnsDescriptor) –

__init__(schema)#

Constructor.

Parameters

schema ({str: PandasSeriesDomain}Dict[str, PandasSeriesDomain]) – Mapping from column name to column domain.

property schema#

Returns mapping from column name to associated domain.

Return type

PandasColumnsDescriptor

property carrier_type#

Returns carrier type for the domain.

Return type

type

validate(value)#

Raises error if value is not a Pandas DataFrame with matching schema.

Parameters

value (Any) –

Return type

None

__eq__(other)#

Return True if the classes are equivalent.

Parameters

other (Any) –

Return type

bool

classmethod from_numpy_types(dtypes)#

Returns a Pandas DataFrame domain from a dictionary of NumPy types.

Parameters

dtypes (Dict[str, numpy.dtype]) –

Return type

PandasDataFrameDomain

__contains__(value)#

Returns True if value is in the domain.

Parameters

value (Any) –

Return type

bool