def test_0d(self): # verify our work around for pd.isnull not working for 0-dimensional # object arrays self.assertTrue(utils.array_equiv(0, np.array(0, dtype=object))) self.assertTrue( utils.array_equiv(np.nan, np.array(np.nan, dtype=object))) self.assertFalse(utils.array_equiv(0, np.array(1, dtype=object)))
def test_0d(self): # verify our work around for pd.isnull not working for 0-dimensional # object arrays self.assertTrue(utils.array_equiv(0, np.array(0, dtype=object))) self.assertTrue( utils.array_equiv(np.nan, np.array(np.nan, dtype=object))) self.assertFalse( utils.array_equiv(0, np.array(1, dtype=object)))
def data_allclose_or_equiv(arr1, arr2, rtol=1e-05, atol=1e-08): if any(arr.dtype.kind == 'S' for arr in [arr1, arr2]): arr1 = decode_string_data(arr1) arr2 = decode_string_data(arr2) exact_dtypes = ['M', 'm', 'O', 'U'] if any(arr.dtype.kind in exact_dtypes for arr in [arr1, arr2]): return utils.array_equiv(arr1, arr2) else: return utils.allclose_or_equiv(arr1, arr2, rtol=rtol, atol=atol)