fatf.utils.array.validation.are_similar_dtype_arrays

fatf.utils.array.validation.are_similar_dtype_arrays(array_a: numpy.ndarray, array_b: numpy.ndarray, strict_comparison: bool = False) → bool[source]

Determines whether two numpy array-like object have a similar data type.

If strict_comparison is set to True the dtypes of both arrays have to be exactly the same. Otherwise, if both their dtypes are either numerical or textual dtypes, they are considered similar.

If one of the arrays is a structured array and the other one is a classic numpy array the function returns False.

Parameters
array_anumpy.ndarray

The first array to be checked.

array_bnumpy.ndarray

The second array to be checked.

strict_comparisonboolean, optional (default=False)

When set to True the dtypes have to match exactly. Otherwise, if both are either numerical or textual dtypes, they are considered similar.

Returns
are_similarboolean

True if both arrays have a similar dtype, False otherwise.

Raises
TypeError

Either of the inputs is not a numpy array-like object.