daf.typing.vectors¶
The types here describe a 1D numpy.ndarray, which can be fetched from daf.
Data:
|
Functions:
|
Check whether some |
|
Assert that some |
|
Access the internal 1D |
- daf.typing.vectors.Vector¶
1-dimensional
numpyarray of bool values.alias of
ndarray
- daf.typing.vectors.is_vector(data: Any, *, dtype: Optional[_dtypes.DTypes] = None, size: Optional[int] = None) TypeGuard[Vector][source]¶
Check whether some
datais aVector, optionally only of somedtype, optionally only of somesize.By default, checks that the data type is one of
ALL_DTYPES.
- daf.typing.vectors.be_vector(data: Any, *, dtype: Optional[Union[str, dtype, Collection[str], Collection[dtype], Collection[Union[str, dtype]]]] = None, size: Optional[int] = None) Vector[source]¶
Assert that some
datais aVector, optionally only of somedtype, optionally only of somesize, and return it as such formypy.By default, checks that the data type is one of
ALL_DTYPES.
- daf.typing.vectors.as_vector(data: Union[Sequence[Any], ndarray, _fake_sparse.spmatrix, Series, DataFrame], *, force_copy: bool = False) Vector[source]¶
Access the internal 1D
numpyarray, if possible; otherwise, or ifforce_copy, return a copy of the 1D data as anumpyarray.Accepts as input data types that aren’t even a
Vector; it will convert a list or a matrix with a single row or a single column into a 1Dnumpyarray.This ensures that
pandasstrings (even if categorical) will be converted to propernumpystrings.