Esempio n. 1
0
def test_set_index(ray_df, pandas_df, keys, inplace=False):
    if not inplace:
        assert rdf.to_pandas(ray_df.set_index(keys)).equals(
            pandas_df.set_index(keys))
    else:
        ray_df_cp = ray_df.copy()
        pd_df_cp = pandas_df.copy()
        ray_df_cp.set_index(keys, inplace=inplace)
        pd_df_cp.set_index(keys, inplace=inplace)
        assert rdf.to_pandas(ray_df_cp).equals(pd_df_cp)
Esempio n. 2
0
def test_reset_index(ray_df, pandas_df, inplace=False):
    if not inplace:
        print(rdf.to_pandas(ray_df.reset_index(inplace=inplace)).index)
        print(pandas_df.reset_index(inplace=inplace))
        assert rdf.to_pandas(ray_df.reset_index(inplace=inplace)).equals(
            pandas_df.reset_index(inplace=inplace))
    else:
        ray_df_cp = ray_df.copy()
        pd_df_cp = pandas_df.copy()
        ray_df_cp.reset_index(inplace=inplace)
        pd_df_cp.reset_index(inplace=inplace)
        assert rdf.to_pandas(ray_df_cp).equals(pd_df_cp)
def ray_df_equals_pandas(ray_df, pandas_df):
    return rdf.to_pandas(ray_df).sort_index().equals(pandas_df.sort_index())
Esempio n. 4
0
def test___neg__(ray_df, pd_df):
    ray_df_neg = ray_df.__neg__()
    assert pd_df.__neg__().equals(rdf.to_pandas(ray_df_neg))
Esempio n. 5
0
def test_set_axis(ray_df, pandas_df, label, axis):
    assert rdf.to_pandas(ray_df.set_axis(label, axis, inplace=False)).equals(
        pandas_df.set_axis(label, axis, inplace=False))
Esempio n. 6
0
def test_query(ray_df, pandas_df, funcs):

    for f in funcs:
        pandas_df_new, ray_df_new = pandas_df.query(f), ray_df.query(f)
        assert pandas_df_new.equals(rdf.to_pandas(ray_df_new))