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

Function test_index_nulls

dask/dataframe/tests/test_dataframe.py:3562–3574  ·  view source on GitHub ↗

Setting the index with some non-numeric null raises error

(null_value)

Source from the content-addressed store, hash-verified

3560
3561@pytest.mark.parametrize("null_value", [None, pd.NaT, pd.NA])
3562def test_index_nulls(null_value):
3563 "Setting the index with some non-numeric null raises error"
3564 df = pd.DataFrame(
3565 {"numeric": [1, 2, 3, 4], "non_numeric": ["foo", "bar", "foo", "bar"]}
3566 )
3567 # an object column with only some nulls fails
3568 ddf = dd.from_pandas(df, npartitions=2)
3569 with pytest.raises(NotImplementedError, match="presence of nulls"):
3570 ddf.set_index(
3571 ddf["non_numeric"].map(
3572 {"foo": "foo", "bar": null_value}, meta=ddf["non_numeric"]._meta
3573 )
3574 ).compute()
3575
3576
3577def test_set_index_with_index():

Callers

nothing calls this directly

Calls 3

set_indexMethod · 0.80
computeMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected