numpy_domains#
Domains for NumPy datatypes.
Classes#
Base class for NumpyDomains. |
|
Domain of NumPy integers. |
|
Domain of NumPy floats. |
|
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
- validate(value)#
Raises an error if value is not in the domain.
- Parameters
value (Any) –
- Return type
None
- 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.
- classmethod from_np_type(dtype)#
Returns a NumPy domain from a Pandas type.
- Parameters
dtype (numpy.dtype) –
- Return type
- validate(value)#
Raises an error if value is not in the domain.
- Parameters
value (Any) –
- Return type
None
- 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.
- 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
- 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
- classmethod from_np_type(dtype)#
Returns a NumPy domain from a Pandas type.
- Parameters
dtype (numpy.dtype) –
- Return type