def array_equivalent(left, right, strict_nan=False):
left, right = np.asarray(left), np.asarray(right)<EOL>if left.shape != right.shape:<EOL><INDENT>return False<EOL><DEDENT>if is_string_dtype(left) or is_string_dtype(right):<EOL><INDENT>if not strict_nan:<EOL><INDENT>return lib.array_equivalent_object(<EOL>ensure_object(left.ravel()), ensure_object(right.ravel()))<EOL><DEDENT>for left_value, right_value in zip(left, right):<EOL><INDENT>if left_value is NaT and right_value is not NaT:<EOL><INDENT>return False<EOL><DEDENT>elif isinstance(left_value, float) and np.isnan(left_value):<EOL><INDENT>if (not isinstance(right_value, float) or<EOL>not np.isnan(right_value)):<EOL><INDENT>return False<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if left_value != right_value:<EOL><INDENT>return False<EOL><DEDENT><DEDENT><DEDENT>return True<EOL><DEDENT>if is_float_dtype(left) or is_complex_dtype(left):<EOL><INDENT>if not (np.prod(left.shape) and np.prod(right.shape)):<EOL><INDENT>return True<EOL><DEDENT>return ((left == right) | (isna(left) & isna(right))).all()<EOL><DEDENT>elif is_datetimelike_v_numeric(left, right):<EOL><INDENT>return False<EOL><DEDENT>elif needs_i8_conversion(left) and needs_i8_conversion(right):<EOL><INDENT>if not is_dtype_equal(left.dtype, right.dtype):<EOL><INDENT>return False<EOL><DEDENT>left = left.view('<STR_LIT>')<EOL>right = right.view('<STR_LIT>')<EOL><DEDENT>if (left.dtype.type is np.void or<EOL>right.dtype.type is np.void):<EOL><INDENT>if left.dtype != right.dtype:<EOL><INDENT>return False<EOL><DEDENT><DEDENT>return np.array_equal(left, right)<EOL>
True if two arrays, left and right, have equal non-NaN elements, and NaNs
in corresponding locations.  False otherwise. It is assumed that left and
right are NumPy arrays of the same dtype. The behavior of this function
(particularly with respect to NaNs) is not defined if the dtypes are
different.

Parameters
----------
left, right : ndarrays
strict_nan : bool, default False
    If True, consider NaN and None to be different.

Returns
-------
b : bool
    Returns True if the arrays are equivalent.

Examples
--------
>>> array_equivalent(
...     np.array([1, 2, np.nan]),
...     np.array([1, 2, np.nan]))
True
>>> array_equivalent(
...     np.array([1, np.nan, 2]),
...     np.array([1, 2, np.nan]))
False