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 comparis
(self, other, equiv=duck_array_ops.array_equiv)
| 1875 | return cls(dims, data, attrs, encoding, fastpath=True) |
| 1876 | |
| 1877 | def equals(self, other, equiv=duck_array_ops.array_equiv): |
| 1878 | """True if two Variables have the same dimensions and values; |
| 1879 | otherwise False. |
| 1880 | |
| 1881 | Variables can still be equal (like pandas objects) if they have NaN |
| 1882 | values in the same locations. |
| 1883 | |
| 1884 | This method is necessary because `v1 == v2` for Variables |
| 1885 | does element-wise comparisons (like numpy.ndarrays). |
| 1886 | """ |
| 1887 | other = getattr(other, "variable", other) |
| 1888 | try: |
| 1889 | return self.dims == other.dims and ( |
| 1890 | self._data is other._data or equiv(self.data, other.data) |
| 1891 | ) |
| 1892 | except (TypeError, AttributeError): |
| 1893 | return False |
| 1894 | |
| 1895 | def broadcast_equals(self, other, equiv=duck_array_ops.array_equiv): |
| 1896 | """True if two Variables have the values after being broadcast against |
no outgoing calls