()
| 984 | |
| 985 | |
| 986 | def 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 | |
| 1004 | def test_map_partitions_propagates_index_metadata(): |
nothing calls this directly
no test coverage detected