예제 #1
0
def test_project_rename_badcolumn():
    df = pd.DataFrame()
    df["A"] = [1, 2]
    df["B"] = [5, 6]
    df["C"] = [7, 8]

    w = Wrap(df)
    with pytest.raises(KeyError):
        wnew = w.project_rename("BB = Q")
예제 #2
0
def test_project_rename_math():
    df = pd.DataFrame()
    df["A"] = [1, 2]
    df["B"] = [5, 6]
    df["C"] = [7, 8]

    w = Wrap(df)
    with pytest.raises(Exception):
        wnew = w.project_rename("BB = A + B")
예제 #3
0
def test_project_rename():
    df = pd.DataFrame()
    df["A"] = [1, 2]
    df["B"] = [5, 6]
    df["C"] = [7, 8]

    w = Wrap(df)
    wnew = w.project_rename("BB = B", CC="C")
    assert ["A", "BB", "CC"] == list(wnew.df.columns)
    assert ["A", "B", "C"] == list(w.df.columns)