コード例 #1
0
def test_reindex_upsample_both_infer():
    node = Pipeline(steps=dummy_classifier)
    node.resample = True
    node.resample_direction = 'both'
    node.resample_rate = None
    times = pd.date_range(start='2018-01-01', periods=3, freq='1s').values
    data = np.arange(25).reshape(5, 5)
    df = node._reindex(data, times, None)
    expected = np.array([
        '2017-12-31T23:59:59',
        '2018-01-01T00:00:00',
        '2018-01-01T00:00:01',
        '2018-01-01T00:00:02',
        '2018-01-01T00:00:03'
        ], dtype=np.datetime64)
    assert np.array_equal(df.index.values, expected)
コード例 #2
0
def test_reindex_resample_right_given():
    node = Pipeline(steps=dummy_classifier)
    node.resample = True
    node.resample_direction = 'right'
    node.resample_rate = 0.5
    times = pd.date_range(start='2018-01-01', periods=10, freq='1s').values
    data = np.arange(25).reshape(5, 5)
    df = node._reindex(data, times, None)
    expected = np.array([
        '2018-01-01T00:00:00',
        '2018-01-01T00:00:02',
        '2018-01-01T00:00:04',
        '2018-01-01T00:00:06',
        '2018-01-01T00:00:08'
        ], dtype=np.datetime64)
    assert np.array_equal(df.index.values, expected)