larray.larray_nan_equal¶
-
larray.larray_nan_equal(a1, a2)[source]¶ Compares two arrays and returns True if they have the same axes and elements, 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, even in the presence of nan values (if they are at the same positions).
See also
Examples
>>> arr1 = ndtest((2, 3), dtype=float) >>> arr1['a1', 'b1'] = nan >>> arr1 a\b b0 b1 b2 a0 0.0 1.0 2.0 a1 3.0 nan 5.0 >>> arr2 = arr1.copy() >>> larray_equal(arr1, arr2) False >>> larray_nan_equal(arr1, arr2) True >>> arr2['b1'] = 0.0 >>> larray_nan_equal(arr1, arr2) False >>> arr3 = arr1.set_labels(X.a, ['x0', 'x1']) >>> larray_nan_equal(arr1, arr3) False >>> larray_nan_equal([0], [0]) True