Beispiel #1
0
def test_exclude():
    c = DateChunker()
    df = DataFrame(data={'data': [1, 2, 3]},
                   index=MultiIndex.from_tuples([(dt(2016, 1, 1), 1),
                                                 (dt(2016, 1, 2), 1),
                                                 (dt(2016, 1, 3), 1)],
                                                names=['date', 'id']))

    df2 = DataFrame(data={'data': [1, 2, 3]})

    assert (c.exclude(df, DateRange(dt(2016, 1, 1), dt(2016, 1, 1))).equals(
        c.exclude(df, pd.date_range(dt(2016, 1, 1), dt(2016, 1, 1)))))
    assert (c.exclude(df2, None).equals(df2))
Beispiel #2
0
def test_exclude_no_index():
    c = DateChunker()
    df = DataFrame(data={'data': [1, 2, 3],
                         'date': [dt(2016, 1, 1),
                                  dt(2016, 1, 2),
                                  dt(2016, 1, 3)]
                         }
                   )

    df2 = DataFrame(data={'data': [1, 2, 3]})

    assert(c.exclude(df, DateRange(dt(2016, 1, 1), dt(2016, 1, 1))).equals(c.exclude(df, pd.date_range(dt(2016, 1, 1), dt(2016, 1, 1)))))
    assert(c.exclude(df2, None).equals(df2))
Beispiel #3
0
def test_exclude():
    c = DateChunker()
    df = DataFrame(data={'data': [1, 2, 3]},
                   index=MultiIndex.from_tuples([(dt(2016, 1, 1), 1),
                                                 (dt(2016, 1, 2), 1),
                                                 (dt(2016, 1, 3), 1)],
                                                names=['date', 'id'])
                   )

    df2 = DataFrame(data={'data': [1, 2, 3]})

    assert(c.exclude(df, DateRange(dt(2016, 1, 1), dt(2016, 1, 1))).equals(c.exclude(df, pd.date_range(dt(2016, 1, 1), dt(2016, 1, 1)))))
    assert(c.exclude(df2, None).equals(df2))
Beispiel #4
0
def test_exclude_no_index():
    c = DateChunker()
    df = DataFrame(data={'data': [1, 2, 3],
                         'date': [dt(2016, 1, 1),
                                  dt(2016, 1, 2),
                                  dt(2016, 1, 3)]
                         }
                   )

    df2 = DataFrame(data={'data': [1, 2, 3]})

    assert(c.exclude(df, DateRange(dt(2016, 1, 1), dt(2016, 1, 1))).equals(c.exclude(df, pd.date_range(dt(2016, 1, 1), dt(2016, 1, 1)))))
    assert(c.exclude(df2, None).equals(df2))