fatf.utils.array.tools
.as_unstructured¶
-
fatf.utils.array.tools.
as_unstructured
(array_like: Union[numpy.ndarray, numpy.void], **kwargs) → Union[numpy.dtype, numpy.ndarray][source]¶ Converts an array like object into an unstructured array.
If the input array is unstructured, it is return without any transformations. Otherwise, if the input array is either a structured array or a structured array row, appropriate structured to unstructured function is called.
Warning
Since this function either calls a local implementation or a builtin numpy function there may be some inconsistencies in its behaviour. One that we are aware of is conversion of arrays that contain
'V'
– raw data (void),'O'
– (Python) objects,'M'
– datetime or'm'
– timedelta dtypes. These types are not supported by the local implementation, however some of them are supported by the numpy built-in, e.g. the'V'
type.- Parameters
- array_likeUnion[numpy.ndarray, numpy.void]
An array, a structured array or a row of a structured numpy array to be converted into a plane numpy array representation.
- **kwargsOptional[numpy.dtype]
Named parameters that are passed to the appropriate structured to unstructured array converter. These parameters are ignored when calling any of the local implementations – see either
fatf.utils.array.tools.structured_to_unstructured_row
orfatf.utils.array.tools.structured_to_unstructured
documentation for details.
- Returns
- classic_arrayUnion[numpy.dtype, numpy.ndarray]
A classic numpy array or numpy dtype (in case the structured row has just one element) representation of the
structured_row
with the most generic type out of the input row’s dtypes.
- Raises
- TypeError
The input array is not a numpy array, a structured numpy array or a row of a structured numpy array.
- ValueError
The input array consists of complex types such as numpy void and object-like types that are not supported by this function.