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

Function test_map_partitions_method_names

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

Source from the content-addressed store, hash-verified

984
985
986def test_map_partitions_method_names():
987 df = pd.DataFrame({"x": [1, 2, 3, 4], "y": [5, 6, 7, 8]})
988 a = dd.from_pandas(df, npartitions=2)
989
990 b = a.map_partitions(lambda x: x)
991 assert isinstance(b, dd.DataFrame)
992 tm.assert_index_equal(b.columns, a.columns)
993
994 b = a.map_partitions(lambda df: df.x + 1)
995 assert isinstance(b, dd.Series)
996 assert b.dtype == "i8"
997
998 b = a.map_partitions(lambda df: df.x + 1, meta=("x", "i8"))
999 assert isinstance(b, dd.Series)
1000 assert b.name == "x"
1001 assert b.dtype == "i8"
1002
1003
1004def test_map_partitions_propagates_index_metadata():

Callers

nothing calls this directly

Calls 1

map_partitionsMethod · 0.45

Tested by

no test coverage detected