Exemplo n.º 1
0
def test_equal_columns_sum_raises_slice():
    df = pd.DataFrame({'A': [None,2,3,4,0], 'B': [1,2,3,4,None]})
    
    with pytest.raises(AssertionError):
        ck.equal_columns_sum(df)
    with pytest.raises(AssertionError):
        dc.equal_columns_sum()(_add_one)(df)

    s = iloc[-3:]
    result = ck.equal_columns_sum(df, s)
    tm.assert_frame_equal(df, result)

    result = dc.equal_columns_sum(s)(_safe_add_one)(df)
    tm.assert_frame_equal(result, _safe_add_one(df))
Exemplo n.º 2
0
def test_equal_columns_sum_raises_slice():
    df = pd.DataFrame({'A': [None, 2, 3, 4, 0], 'B': [1, 2, 3, 4, None]})

    with pytest.raises(AssertionError):
        ck.equal_columns_sum(df)
    with pytest.raises(AssertionError):
        dc.equal_columns_sum()(_add_one)(df)

    s = iloc[-3:]
    result = ck.equal_columns_sum(df, s)
    tm.assert_frame_equal(df, result)

    result = dc.equal_columns_sum(s)(_safe_add_one)(df)
    tm.assert_frame_equal(result, _safe_add_one(df))
Exemplo n.º 3
0
def test_equal_columns_sum():
    df = pd.DataFrame({'A': [1,2,3,4,5], 'B': [1,2,3,4,5]})
    
    result = ck.equal_columns_sum(df)
    tm.assert_frame_equal(df, result)

    result = dc.equal_columns_sum()(_add_one)(df)
    tm.assert_frame_equal(result, df + 1)
Exemplo n.º 4
0
def test_equal_columns_sum():
    df = pd.DataFrame({'A': [1, 2, 3, 4, 5], 'B': [1, 2, 3, 4, 5]})

    result = ck.equal_columns_sum(df)
    tm.assert_frame_equal(df, result)

    result = dc.equal_columns_sum()(_add_one)(df)
    tm.assert_frame_equal(result, df + 1)