numpy_domains#

Domains for NumPy datatypes.

Classes#

NumpyDomain

Base class for NumpyDomains.

NumpyIntegerDomain

Domain of NumPy integers.

NumpyFloatDomain

Domain of NumPy floats.

NumpyStringDomain

Domain of NumPy strings.

class NumpyDomain#

Bases: tmlt.core.domains.base.Domain

Base class for NumpyDomains.

classmethod from_np_type(dtype)#

Returns a NumPy domain from a Pandas type.

Parameters

dtype (numpy.dtype) –

Return type

NumpyDomain

property carrier_type#

Returns the type of elements in the domain.

Return type

type

validate(value)#

Raises an error if value is not in the domain.

Parameters

value (Any) –

Return type

None

__contains__(value)#

Returns True if value is in the domain.

Parameters

value (Any) –

Return type

bool

class NumpyIntegerDomain#

Bases: NumpyDomain

Domain of NumPy integers.

size :int = 64#

Number of bits a member of the domain occupies. Must be 32 or 64.

property carrier_type#

Returns carrier type for elements in the domain.

Return type

type

classmethod from_np_type(dtype)#

Returns a NumPy domain from a Pandas type.

Parameters

dtype (numpy.dtype) –

Return type

NumpyDomain

validate(value)#

Raises an error if value is not in the domain.

Parameters

value (Any) –

Return type

None

__contains__(value)#

Returns True if value is in the domain.

Parameters

value (Any) –

Return type

bool

class NumpyFloatDomain#

Bases: NumpyDomain

Domain of NumPy floats.

allow_nan :bool = False#

If True, NaNs are permitted in the domain.

allow_inf :bool = False#

If True, infs are permitted in the domain.

size :int = 64#

Number of bits a member of the domain occupies. Must be 32 or 64.

property carrier_type#

Returns carrier type for elements in the domain.

Return type

type

validate(value)#

Raises error if value is not a member of the domain.

Parameters

value (Any) –

Return type

None

classmethod from_np_type(dtype)#

Returns a NumPy domain from a Pandas type.

Parameters

dtype (numpy.dtype) –

Return type

NumpyDomain

__contains__(value)#

Returns True if value is in the domain.

Parameters

value (Any) –

Return type

bool

class NumpyStringDomain#

Bases: NumpyDomain

Domain of NumPy strings.

Note

This domain does not use numpy.str_ datatype. Instead, native python objects are used since Pandas uses this by default.

allow_null :bool = False#

If True, None is allowed.

validate(value)#

Raises error if value is not in domain.

Parameters

value (Any) –

Return type

None

property carrier_type#

Returns carrier types for members of NumpyStringDomain.

Return type

type

classmethod from_np_type(dtype)#

Returns a NumPy domain from a Pandas type.

Parameters

dtype (numpy.dtype) –

Return type

NumpyDomain

__contains__(value)#

Returns True if value is in the domain.

Parameters

value (Any) –

Return type

bool