Esempio n. 1
0
 def dtype(self):
     return PeriodDtype.construct_from_string(self.freq)
Esempio n. 2
0
 def dtype(self):
     return PeriodDtype.construct_from_string(self.freq)
Esempio n. 3
0
    def test_construction_from_string(self):
        result = PeriodDtype('period[D]')
        self.assertTrue(is_dtype_equal(self.dtype, result))
        result = PeriodDtype.construct_from_string('period[D]')
        self.assertTrue(is_dtype_equal(self.dtype, result))
        with tm.assertRaises(TypeError):
            PeriodDtype.construct_from_string('foo')
        with tm.assertRaises(TypeError):
            PeriodDtype.construct_from_string('period[foo]')
        with tm.assertRaises(TypeError):
            PeriodDtype.construct_from_string('foo[D]')

        with tm.assertRaises(TypeError):
            PeriodDtype.construct_from_string('datetime64[ns]')
        with tm.assertRaises(TypeError):
            PeriodDtype.construct_from_string('datetime64[ns, US/Eastern]')
Esempio n. 4
0
    def test_construction_from_string(self):
        result = PeriodDtype('period[D]')
        self.assertTrue(is_dtype_equal(self.dtype, result))
        result = PeriodDtype.construct_from_string('period[D]')
        self.assertTrue(is_dtype_equal(self.dtype, result))
        with tm.assertRaises(TypeError):
            PeriodDtype.construct_from_string('foo')
        with tm.assertRaises(TypeError):
            PeriodDtype.construct_from_string('period[foo]')
        with tm.assertRaises(TypeError):
            PeriodDtype.construct_from_string('foo[D]')

        with tm.assertRaises(TypeError):
            PeriodDtype.construct_from_string('datetime64[ns]')
        with tm.assertRaises(TypeError):
            PeriodDtype.construct_from_string('datetime64[ns, US/Eastern]')