示例#1
0
文件: test_df.py 项目: wseaton/polars
def test_to_pandas():
    df = get_complete_df()
    df.to_arrow()
    df.to_pandas()
    # test shifted df
    df.shift(2).to_pandas()
    df = DataFrame({"col": Series([True, False, True])})
    print(df)
    df.shift(2).to_pandas()
示例#2
0
def test_to_pandas():
    df = DataFrame({
        "bools": [False, True, False],
        "bools_nulls": [None, True, False],
        "int": [1, 2, 3],
        "int_nulls": [1, None, 3],
        "floats": [1.0, 2.0, 3.0],
        "floats_nulls": [1.0, None, 3.0],
        "strings": ["foo", "bar", "ham"],
        "strings_nulls": ["foo", None, "ham"],
    })
    df.to_arrow()
    df.to_pandas()
    # test shifted df
    df.shift(2).to_pandas()
    df = DataFrame({"col": Series([True, False, True])})
    print(df)
    df.shift(2).to_pandas()
示例#3
0
def test_shift():
    df = DataFrame({"A": ["a", "b", "c"], "B": [1, 3, 5]})
    a = df.shift(1)
    b = DataFrame({"A": [None, "a", "b"], "B": [None, 1, 3]}, nullable=True)
    assert a.frame_equal(b, null_equal=True)