def setUp(self): ArkoudaTest.setUp(self) self.dtvec1 = ak.date_range(start='2021-01-01 12:00:00', periods=100, freq='s') self.dtvec2 = ak.Datetime(pd.date_range('2021-01-01 12:00:00', periods=100, freq='s')) self.dtscalar = pd.Timestamp('2021-01-01 12:00:00') self.tdvec1 = ak.timedelta_range(start='1 second', end='1 second', periods=100) self.tdvec2 = ak.Timedelta(ak.ones(100, dtype=ak.int64), unit='s') self.onesecond = pd.Timedelta(1, unit='s')
def check_equal(pdunit, akunit): pdval = pd.Timestamp(1, unit=pdunit) akval = ak.Datetime(ak.ones(10, dtype=ak.int64), unit=akunit)[0] try: self.assertEqual(pdval, akval) except AssertionError: logging.getLogger().error("pandas {} ({}) != arkouda {} ({})".format(pdunit, pdval, akunit, akval)) pdval = pd.Timedelta(1, unit=pdunit) akval = ak.Timedelta(ak.ones(10, dtype=ak.int64), unit=akunit)[0] try: self.assertEqual(pdval, akval) except AssertionError: logging.getLogger().error("pandas {} ({}) != arkouda {} ({})".format(pdunit, pdval, akunit, akval))
def test_roundtrip(self): d = ak.Datetime(self.dtvec1.to_ndarray()) self.assertTrue((d == self.dtvec1).all())
def test_noop_creation(self): self.assertTrue((ak.Datetime(self.dtvec1) == self.dtvec1).all()) self.assertTrue((ak.Timedelta(self.tdvec1) == self.tdvec1).all())