Skip to content

Commit d1c5053

Browse files
committed
add multi-index and categorical tests
1 parent 992eaff commit d1c5053

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

pandas/tests/groupby/test_groupby_dropna.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,13 +389,22 @@ def test_groupby_nan_included():
389389
[
390390
pytest.param("group", id="column"),
391391
pytest.param(pd.Series(["g1", np.nan, "g1", "g2", np.nan]), id="Series"),
392+
pytest.param(
393+
pd.Series(["g1", np.nan, "g1", "g2", np.nan]).astype("category"),
394+
id="Categorical",
395+
),
392396
pytest.param("_index", id="index"),
397+
pytest.param(["group", "group2"], id="multikey"),
393398
],
394399
)
395400
@pytest.mark.parametrize("dropna", [True, False, None])
396401
def test_groupby_nan_included_warns(by, dropna):
397402
# GH 61339
398-
data = {"group": ["g1", np.nan, "g1", "g2", np.nan], "B": [0, 1, 2, 3, 4]}
403+
data = {
404+
"group": ["g1", np.nan, "g1", "g2", np.nan],
405+
"group2": ["g1", "g2", np.nan, "g2", np.nan],
406+
"B": [0, 1, 2, 3, 4],
407+
}
399408
df = pd.DataFrame(data)
400409
if isinstance(by, str) and by == "_index":
401410
df = df.set_index("group")

0 commit comments

Comments
 (0)