larray.larray_equal¶
-
larray.larray_equal(a1, a2)[source]¶ Compares two arrays and returns True if they have the same axes and elements (and do not contain nan values, see note below), False otherwise.
Parameters: a1, a2 : LArray-like
Input arrays. aslarray() is used on non-LArray inputs.
Returns: bool
Returns True if the arrays are equal (and do not contain nan values).
See also
Notes
An array containing nan values is never equal to another array, even if that other array also contains nan values at the same positions. The reason is that a nan value is different from anything, including itself. One might want to use larray_nan_equal to avoid this behavior.
Examples
>>> arr1 = ndtest((2, 3)) >>> arr1 a\b b0 b1 b2 a0 0 1 2 a1 3 4 5 >>> arr2 = arr1.copy() >>> larray_equal(arr1, arr2) True >>> arr2['b1'] += 1 >>> larray_equal(arr1, arr2) False >>> arr3 = arr1.set_labels(X.a, ['x0', 'x1']) >>> larray_equal(arr1, arr3) False