예제 #1
0
 def test_0d(self):
     # verify our work around for pd.isnull not working for 0-dimensional
     # object arrays
     self.assertTrue(ops.array_equiv(0, np.array(0, dtype=object)))
     self.assertTrue(ops.array_equiv(np.nan, np.array(np.nan,
                                                      dtype=object)))
     self.assertFalse(ops.array_equiv(0, np.array(1, dtype=object)))
예제 #2
0
파일: test_utils.py 프로젝트: rabernat/xray
 def test_0d(self):
     # verify our work around for pd.isnull not working for 0-dimensional
     # object arrays
     self.assertTrue(ops.array_equiv(0, np.array(0, dtype=object)))
     self.assertTrue(
         ops.array_equiv(np.nan, np.array(np.nan, dtype=object)))
     self.assertFalse(
         ops.array_equiv(0, np.array(1, dtype=object)))
예제 #3
0
파일: __init__.py 프로젝트: gyenney/Tools
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 ops.array_equiv(arr1, arr2)
    else:
        return ops.allclose_or_equiv(arr1, arr2, rtol=rtol, atol=atol)
예제 #4
0
파일: __init__.py 프로젝트: petercable/xray
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 ops.array_equiv(arr1, arr2)
    else:
        return ops.allclose_or_equiv(arr1, arr2, rtol=rtol, atol=atol)
예제 #5
0
파일: __init__.py 프로젝트: psederberg/xray
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 ops.array_equiv(arr1, arr2)
    else:
        return ops.allclose_or_equiv(arr1, arr2, rtol=rtol, atol=atol)