Skip to content

Commit bee17d5

Browse files
authored
TST: make df[Name] a Categorical (#28824)
1 parent 558f754 commit bee17d5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Diff for: pandas/tests/groupby/test_categorical.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1195,9 +1195,12 @@ def test_groupby_categorical_axis_1(code):
11951195
assert_frame_equal(result, expected)
11961196

11971197

1198-
def test_groupby_cat_preserves_structure(observed):
1198+
def test_groupby_cat_preserves_structure(observed, ordered_fixture):
11991199
# GH 28787
1200-
df = DataFrame([("Bob", 1), ("Greg", 2)], columns=["Name", "Item"])
1200+
df = DataFrame(
1201+
{"Name": Categorical(["Bob", "Greg"], ordered=ordered_fixture), "Item": [1, 2]},
1202+
columns=["Name", "Item"],
1203+
)
12011204
expected = df.copy()
12021205

12031206
result = (

0 commit comments

Comments
 (0)