fatf.utils.array.validation.are_similar_dtypes

fatf.utils.array.validation.are_similar_dtypes(dtype_a, dtype_b, strict_comparison=False)[source]

Checks whether two numpy dtypes are similar.

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

Parameters
dtype_anumpy.dtype

The first dtype to be compared.

dtype_bnumpy.dtype

The second dtype to be compared.

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 dtypes are similar, False otherwise.

Raises
TypeError

Either of the inputs is not a numpy’s dtype object.

ValueError

Either of the input dtypes is structured – this function only accepts plane dtypes.