Exemplo n.º 1
0
    def test_basic(self):
        self.assertTrue(is_period_dtype(self.dtype))

        pidx = pd.period_range('2013-01-01 09:00', periods=5, freq='H')

        self.assertTrue(is_period_dtype(pidx.dtype))
        self.assertTrue(is_period_dtype(pidx))
        self.assertTrue(is_period(pidx))

        s = Series(pidx, name='A')
        # dtypes
        # series results in object dtype currently,
        # is_period checks period_arraylike
        self.assertFalse(is_period_dtype(s.dtype))
        self.assertFalse(is_period_dtype(s))
        self.assertTrue(is_period(s))

        self.assertFalse(is_period_dtype(np.dtype('float64')))
        self.assertFalse(is_period_dtype(1.0))
        self.assertFalse(is_period(np.dtype('float64')))
        self.assertFalse(is_period(1.0))
Exemplo n.º 2
0
    def test_basic(self):
        self.assertTrue(is_period_dtype(self.dtype))

        pidx = pd.period_range('2013-01-01 09:00', periods=5, freq='H')

        self.assertTrue(is_period_dtype(pidx.dtype))
        self.assertTrue(is_period_dtype(pidx))
        self.assertTrue(is_period(pidx))

        s = Series(pidx, name='A')
        # dtypes
        # series results in object dtype currently,
        # is_period checks period_arraylike
        self.assertFalse(is_period_dtype(s.dtype))
        self.assertFalse(is_period_dtype(s))
        self.assertTrue(is_period(s))

        self.assertFalse(is_period_dtype(np.dtype('float64')))
        self.assertFalse(is_period_dtype(1.0))
        self.assertFalse(is_period(np.dtype('float64')))
        self.assertFalse(is_period(1.0))