MCPcopy Create free account
hub / github.com/dask/dask / test_align_dataframes

Function test_align_dataframes

dask/dataframe/tests/test_dataframe.py:1065–1082  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1063
1064
1065def test_align_dataframes():
1066 df1 = pd.DataFrame({"A": [1, 2, 3, 3, 2, 3], "B": [1, 2, 3, 4, 5, 6]})
1067 df2 = pd.DataFrame({"A": [3, 1, 2], "C": [1, 2, 3]})
1068
1069 ddf1 = dd.from_pandas(df1, npartitions=2)
1070 ddf2 = dd.from_pandas(df2, npartitions=1)
1071
1072 actual = ddf1.map_partitions(
1073 pd.merge, df2, align_dataframes=False, left_on="A", right_on="A", how="left"
1074 )
1075 expected = pd.merge(df1, df2, left_on="A", right_on="A", how="left")
1076 assert_eq(actual, expected, check_index=False, check_divisions=False)
1077
1078 actual = ddf2.map_partitions(
1079 pd.merge, ddf1, align_dataframes=False, left_on="A", right_on="A", how="right"
1080 )
1081 expected = pd.merge(df2, df1, left_on="A", right_on="A", how="right")
1082 assert_eq(actual, expected, check_index=False, check_divisions=False)
1083
1084
1085def test_drop_duplicates(shuffle_method):

Callers

nothing calls this directly

Calls 3

assert_eqFunction · 0.90
map_partitionsMethod · 0.45
mergeMethod · 0.45

Tested by

no test coverage detected