Exemplo n.º 1
0
    def test_daterange_bug_456(self):
        # GH #456
        rng1 = cdate_range('12/5/2011', '12/5/2011')
        rng2 = cdate_range('12/2/2011', '12/5/2011')
        rng2.offset = CDay()

        result = rng1.union(rng2)
        tm.assertIsInstance(result, DatetimeIndex)
Exemplo n.º 2
0
    def test_daterange_bug_456(self):
        # GH #456
        rng1 = cdate_range('12/5/2011', '12/5/2011')
        rng2 = cdate_range('12/2/2011', '12/5/2011')
        rng2.offset = CDay()

        result = rng1.union(rng2)
        assert isinstance(result, DatetimeIndex)
Exemplo n.º 3
0
 def test_cdaterange_weekmask_and_holidays(self):
     rng = cdate_range('2013-05-01',
                       periods=3,
                       weekmask='Sun Mon Tue Wed Thu',
                       holidays=['2013-05-01'])
     xp = DatetimeIndex(['2013-05-02', '2013-05-05', '2013-05-06'])
     self.assert_index_equal(xp, rng)
Exemplo n.º 4
0
    def test_misc(self):
        end = datetime(2009, 5, 13)
        dr = cdate_range(end=end, periods=20)
        firstDate = end - 19 * CDay()

        assert len(dr) == 20
        assert dr[0] == firstDate
        assert dr[-1] == end
Exemplo n.º 5
0
    def test_misc(self):
        end = datetime(2009, 5, 13)
        dr = cdate_range(end=end, periods=20)
        firstDate = end - 19 * CDay()

        assert len(dr) == 20
        assert dr[0] == firstDate
        assert dr[-1] == end
Exemplo n.º 6
0
    def test_constructor(self):
        cdate_range(START, END, freq=CDay())
        cdate_range(START, periods=20, freq=CDay())
        cdate_range(end=START, periods=20, freq=CDay())

        msg = 'periods must be a number, got C'
        with tm.assert_raises_regex(TypeError, msg):
            date_range('2011-1-1', '2012-1-1', 'C')

        with tm.assert_raises_regex(TypeError, msg):
            cdate_range('2011-1-1', '2012-1-1', 'C')
Exemplo n.º 7
0
    def test_constructor(self):
        cdate_range(START, END, freq=CDay())
        cdate_range(START, periods=20, freq=CDay())
        cdate_range(end=START, periods=20, freq=CDay())

        msg = 'periods must be a number, got C'
        with tm.assert_raises_regex(TypeError, msg):
            date_range('2011-1-1', '2012-1-1', 'C')

        with tm.assert_raises_regex(TypeError, msg):
            cdate_range('2011-1-1', '2012-1-1', 'C')
Exemplo n.º 8
0
 def test_cdaterange(self):
     rng = cdate_range('2013-05-01', periods=3)
     xp = DatetimeIndex(['2013-05-01', '2013-05-02', '2013-05-03'])
     self.assert_index_equal(xp, rng)
Exemplo n.º 9
0
 def test_cdaterange_holidays(self):
     rng = cdate_range('2013-05-01', periods=3, holidays=['2013-05-01'])
     xp = DatetimeIndex(['2013-05-02', '2013-05-03', '2013-05-06'])
     self.assert_index_equal(xp, rng)
Exemplo n.º 10
0
 def test_cdaterange_holidays(self):
     rng = cdate_range('2013-05-01', periods=3, holidays=['2013-05-01'])
     xp = DatetimeIndex(['2013-05-02', '2013-05-03', '2013-05-06'])
     tm.assert_index_equal(xp, rng)
Exemplo n.º 11
0
 def test_cdaterange(self):
     rng = cdate_range('2013-05-01', periods=3)
     xp = DatetimeIndex(['2013-05-01', '2013-05-02', '2013-05-03'])
     tm.assert_index_equal(xp, rng)
Exemplo n.º 12
0
 def setUp(self):
     self.rng = cdate_range(START, END)
Exemplo n.º 13
0
 def test_constructor(self):
     cdate_range(START, END, freq=CDay())
     cdate_range(START, periods=20, freq=CDay())
     cdate_range(end=START, periods=20, freq=CDay())
     self.assertRaises(ValueError, date_range, '2011-1-1', '2012-1-1', 'C')
     self.assertRaises(ValueError, cdate_range, '2011-1-1', '2012-1-1', 'C')
Exemplo n.º 14
0
 def test_constructor(self):
     cdate_range(START, END, freq=CDay())
     cdate_range(START, periods=20, freq=CDay())
     cdate_range(end=START, periods=20, freq=CDay())
     self.assertRaises(ValueError, date_range, '2011-1-1', '2012-1-1', 'C')
     self.assertRaises(ValueError, cdate_range, '2011-1-1', '2012-1-1', 'C')
Exemplo n.º 15
0
 def test_intersection_bug(self):
     # GH #771
     a = cdate_range('11/30/2011', '12/31/2011')
     b = cdate_range('12/10/2011', '12/20/2011')
     result = a.intersection(b)
     tm.assert_index_equal(result, b)
Exemplo n.º 16
0
 def test_cdaterange_weekmask_and_holidays(self):
     rng = cdate_range('2013-05-01', periods=3,
                       weekmask='Sun Mon Tue Wed Thu',
                       holidays=['2013-05-01'])
     xp = DatetimeIndex(['2013-05-02', '2013-05-05', '2013-05-06'])
     tm.assert_index_equal(xp, rng)
Exemplo n.º 17
0
 def setup_method(self, method):
     self.rng = cdate_range(START, END)
Exemplo n.º 18
0
 def setup_method(self, method):
     self.rng = cdate_range(START, END)
Exemplo n.º 19
0
 def setUp(self):
     self.rng = cdate_range(START, END)
Exemplo n.º 20
0
 def test_cdaterange_weekmask(self):
     rng = cdate_range('2013-05-01',
                       periods=3,
                       weekmask='Sun Mon Tue Wed Thu')
     xp = DatetimeIndex(['2013-05-01', '2013-05-02', '2013-05-05'])
     tm.assert_index_equal(xp, rng)
Exemplo n.º 21
0
 def test_deprecation_cdaterange(self):
     # GH17596
     from pandas.core.indexes.datetimes import cdate_range
     with tm.assert_produces_warning(FutureWarning,
                                     check_stacklevel=False):
         cdate_range('2017-01-01', '2017-12-31')
Exemplo n.º 22
0
 def test_intersection_bug(self):
     # GH #771
     a = cdate_range('11/30/2011', '12/31/2011')
     b = cdate_range('12/10/2011', '12/20/2011')
     result = a.intersection(b)
     tm.assert_index_equal(result, b)