Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dask_expr/_dummies.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ class GetDummies(Blockwise):
"prefix_sep",
"dummy_na",
"columns",
"sparse",
"drop_first",
"dtype",
]
Expand All @@ -164,9 +165,12 @@ class GetDummies(Blockwise):
"prefix_sep": "_",
"dummy_na": False,
"columns": None,
"sparse": False,
"drop_first": False,
"dtype": bool,
}
# cudf has extra kwargs after `columns`
_keyword_only = ["sparse", "drop_first", "dtype"]

@staticmethod
def operation(df, *args, **kwargs):
Expand Down
9 changes: 6 additions & 3 deletions dask_expr/tests/test_dummies.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import pandas
import pytest

from dask_expr import from_pandas, get_dummies
Expand All @@ -10,9 +11,11 @@
"data",
[
pd.Series([1, 1, 1, 2, 2, 1, 3, 4], dtype="category"),
pd.Series(pd.Categorical([1, 1, 1, 2, 2, 1, 3, 4], categories=[4, 3, 2, 1])),
pd.Series(
pandas.Categorical([1, 1, 1, 2, 2, 1, 3, 4], categories=[4, 3, 2, 1])
),
pd.DataFrame(
{"a": [1, 2, 3, 4, 4, 3, 2, 1], "b": pd.Categorical(list("abcdabcd"))}
{"a": [1, 2, 3, 4, 4, 3, 2, 1], "b": pandas.Categorical(list("abcdabcd"))}
),
],
)
Expand All @@ -22,4 +25,4 @@ def test_get_dummies(data):
ddata = from_pandas(data, 2)
res = get_dummies(ddata)
assert_eq(res, exp)
pd.testing.assert_index_equal(res.columns, exp.columns)
pandas.testing.assert_index_equal(res.columns, exp.columns)