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

Function test_map

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

Source from the content-addressed store, hash-verified

1656
1657
1658def test_map():
1659 df = pd.DataFrame(
1660 {"a": range(9), "b": [4, 5, 6, 1, 2, 3, 0, 0, 0]},
1661 index=pd.Index([0, 1, 3, 5, 6, 8, 9, 9, 9], name="myindex"),
1662 )
1663 ddf = dd.from_pandas(df, npartitions=3)
1664 with pytest.warns(UserWarning, match="meta"):
1665 assert_eq(ddf.a.map(lambda x: x + 1), df.a.map(lambda x: x + 1))
1666 lk = {v: v + 1 for v in df.a.values}
1667 assert_eq(ddf.a.map(lk), df.a.map(lk))
1668 assert_eq(ddf.b.map(lk), df.b.map(lk))
1669 lk = pd.Series(lk)
1670 assert_eq(ddf.a.map(lk), df.a.map(lk))
1671 assert_eq(ddf.b.map(lk), df.b.map(lk))
1672 assert_eq(ddf.b.map(lk, meta=ddf.b), df.b.map(lk))
1673 assert_eq(ddf.b.map(lk, meta=("b", "i8")), df.b.map(lk))
1674
1675
1676def test_concat():

Callers

nothing calls this directly

Calls 2

assert_eqFunction · 0.90
mapMethod · 0.45

Tested by

no test coverage detected