def equals(self, other):
        """True if two Variables have the same dimensions and values;
        otherwise False.

        Variables can still be equal (like pandas objects) if they have NaN
        values in the same locations.

        This method is necessary because `v1 == v2` for Variables
        does element-wise comparisions (like numpy.ndarrays).
        """
        other = getattr(other, 'variable', other)
        try:
            return (self.dims == other.dims and self._data_equals(other))
        except (TypeError, __HOLE__):
            return False
dataset/ETHPy150Open pydata/xarray/xarray/core/variable.py/Variable.equals