nums.numpy.array_equal

nums.numpy.array_equal(a, b, equal_nan=False)[source]

True if two arrays have the same shape and elements, False otherwise.

This docstring was copied from numpy.array_equal.

Some inconsistencies with the NumS version may exist.

Parameters
  • a1 (BlockArray) – Input arrays.

  • a2 (BlockArray) – Input arrays.

  • equal_nan (bool) – Whether to compare NaN’s as equal. If the dtype of a1 and a2 is complex, values will be considered equal if either the real or the imaginary component of a given value is nan.

Returns

b – Returns True if the arrays are equal.

Return type

bool

See also

allclose

Returns True if two arrays are element-wise equal within a tolerance.

array_equiv

Returns True if input arrays are shape consistent and all elements equal.

Notes

equal_nan=True not supported.

Examples

The doctests shown below are copied from NumPy. They won’t show the correct result until you operate get().

>>> nps.array_equal(nps.array([1, 2]), nps.array([1, 2])).get()  
array(True)
>>> a = nps.array([1, nps.nan])  
>>> nps.array_equal(a, a).get()  
array(False)