can_cast

can_cast(from_: Union[dtype, array], to: dtype, /) bool

Determines if one data type can be cast to another data type according Type Promotion Rules rules.

Parameters
  • from (Union[dtype, array]) – input data type or array from which to cast.

  • to (dtype) – desired data type.

Returns

out (bool) – True if the cast can occur according to Type Promotion Rules rules; otherwise, False.