Equana

Back to Numerical Arrays (NumPy)

np.can_cast

Returns true if cast between data types can occur according to the casting rule.

Syntax

np.can_cast(from, to, casting?)

Description

Returns true if cast between data types can occur according to the casting rule.

Parameters

NameDescription
from- Data type to cast from
to- Data type to cast to
casting(optional)- Controls what kind of data casting may occur: - 'no': No casting allowed - 'equiv': Only byte-order changes allowed - 'safe': Only casts that can preserve values allowed - 'same_kind': Only safe casts or casts within a kind allowed - 'unsafe': Any data conversions allowed

Returns

boolean