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

Function test_map_meta

dask/dataframe/dask_expr/tests/test_collection.py:941–958  ·  view source on GitHub ↗
(pdf, df)

Source from the content-addressed store, hash-verified

939
940
941def test_map_meta(pdf, df):
942 expected = pdf.x.map(lambda x: x + 1)
943 result = df.x.map(lambda x: x + 1, meta=expected.iloc[:0])
944 assert_eq(result, expected)
945
946 result = df.x.map(df.x + 1, meta=expected.iloc[:0])
947 assert_eq(result, expected)
948
949 result = df.x.map(df.x + 1, meta=("x", "int64"))
950 assert_eq(result, expected)
951
952 result = df.x.map((df.x + 1).compute(), meta=("x", "int64"))
953 assert_eq(result, expected)
954
955 pdf.index.name = "a"
956 df = from_pandas(pdf, npartitions=10)
957 result = df.x.map(lambda x: x + 1, meta=("x", "int64"))
958 assert_eq(result, expected)
959
960
961def test_simplify_add_suffix_add_prefix(df, pdf):

Callers

nothing calls this directly

Calls 4

assert_eqFunction · 0.90
from_pandasFunction · 0.90
mapMethod · 0.45
computeMethod · 0.45

Tested by

no test coverage detected