Beispiel #1
0
def test_distinct_star():
    df = pd.DataFrame()
    df["A"] = [1, 1, 1, 2, 2, 2, 1]
    df["B"] = [1, 1, 2, 2, 3, 3, 1]

    w = Wrap(df)

    wnew = w.distinct("*")

    assert ["A", "B"] == list(wnew.df.columns)
    assert [1, 1, 2, 2] == list(wnew.df["A"])
    assert [1, 2, 2, 3] == list(wnew.df["B"])
Beispiel #2
0
def test_distinct_one_arg():
    df = pd.DataFrame()
    df["A"] = [1, 1, 1, 2, 2, 2, 1]
    df["B"] = [1, 1, 2, 2, 3, 3, 1]
    df["C"] = [1, 2, 3, 4, 5, 6, 7]

    w = Wrap(df)

    wnew = w.distinct("A")

    assert ["A"] == list(wnew.df.columns)
    assert [1, 2] == list(wnew.df["A"])