Setting the index with some non-numeric null raises error
(null_value)
| 3569 | |
| 3570 | @pytest.mark.parametrize("null_value", [None, pd.NaT, pd.NA]) |
| 3571 | def test_index_nulls(null_value): |
| 3572 | "Setting the index with some non-numeric null raises error" |
| 3573 | df = pd.DataFrame( |
| 3574 | {"numeric": [1, 2, 3, 4], "non_numeric": ["foo", "bar", "foo", "bar"]} |
| 3575 | ) |
| 3576 | # an object column with only some nulls fails |
| 3577 | ddf = dd.from_pandas(df, npartitions=2) |
| 3578 | with pytest.raises(NotImplementedError, match="presence of nulls"): |
| 3579 | ddf.set_index( |
| 3580 | ddf["non_numeric"].map( |
| 3581 | {"foo": "foo", "bar": null_value}, meta=ddf["non_numeric"]._meta |
| 3582 | ) |
| 3583 | ).compute() |
| 3584 | |
| 3585 | |
| 3586 | def test_set_index_with_index(): |