def nan_equal(first_array, second_array):
<EOL>if first_array.shape != second_array.shape:<EOL><INDENT>return False<EOL><DEDENT>if (first_array.dtype.names is None and second_array.dtype.names is not None) or (first_array.dtype.names is not None and second_array.dtype.names is None):<EOL><INDENT>return False<EOL><DEDENT>if first_array.dtype.names is None:  <EOL><INDENT>if first_array.dtype != second_array.dtype:<EOL><INDENT>return False<EOL><DEDENT>try:<EOL><INDENT>np.testing.assert_equal(first_array, second_array)<EOL><DEDENT>except AssertionError:<EOL><INDENT>return False<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if first_array.dtype.names != second_array.dtype.names:<EOL><INDENT>return False<EOL><DEDENT>for column in first_array.dtype.names:<EOL><INDENT>if first_array[column].dtype != second_array[column].dtype:<EOL><INDENT>return False<EOL><DEDENT>try:<EOL><INDENT>np.testing.assert_equal(first_array[column], second_array[column])<EOL><DEDENT>except AssertionError:<EOL><INDENT>return False<EOL><DEDENT><DEDENT><DEDENT>return True<EOL>
Compares two arrays and test for equality.

    Works with recarrays.
    NaNs are considered equal.

    Parameters
    ----------
    first_array : numpy.ndarray
    second_array : numpy.ndarray

    Returns
    -------
    boolean