nanequal#
- nanequal(arr, *args, scalar=False, equal_nan=True)[source]#
Compare two or more arrays for equality element-wise, treating NaN values as equal.
Unnlike
numpy.array_equal()
, this function works even if the arrays cannot be cast to float.- Parameters:
Examples:
arr1 = np.array([1, 2, np.nan]) arr2 = [1, 2, np.nan] sc.nanequal(arr1, arr2) # Returns array([ True, True, True]) arr3 = [3, np.nan, 'foo'] sc.nanequal(arr3, arr3, arr3, scalar=True) # Returns True
New in version 3.1.0.