Skip to content

Commit f535c40

Browse files
committed
Check for null values in nw one-hot-encoding.
1 parent f37f7e3 commit f535c40

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

metalearners/_narwhals_utils.py

+5
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ def nw_to_dummies(
2929
if set(categories) < set(x.unique()):
3030
raise ValueError("We observed a value which isn't part of the categories.")
3131

32+
if any(x.is_null()):
33+
raise ValueError(
34+
"Can only apply nw_to_dummies on a narwhals Series without null values."
35+
)
36+
3237
relevant_categories = categories[1:] if drop_first else categories
3338
return x.to_frame().select(
3439
[

0 commit comments

Comments
 (0)