Skip to content

Commit 2e95853

Browse files
committed
Move tests to tests/frame/indexing/test_categorical.py
1 parent b1520b8 commit 2e95853

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pandas/tests/frame/indexing/test_categorical.py

+10
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,16 @@ def test_functions_no_warnings(self):
354354
df.value, range(0, 105, 10), right=False, labels=labels
355355
)
356356

357+
def test_setitem_single_row_categorical(self):
358+
# GH 25495
359+
df = DataFrame({"Alpha": ["a"], "Numeric": [0]})
360+
categories = pd.Categorical(df["Alpha"], categories=["a", "b", "c"])
361+
df.loc[:, "Alpha"] = categories
362+
363+
result = df["Alpha"]
364+
expected = Series(categories, index=df.index, name="Alpha")
365+
tm.assert_series_equal(result, expected)
366+
357367
def test_loc_indexing_preserves_index_category_dtype(self):
358368
# GH 15166
359369
df = DataFrame(

0 commit comments

Comments
 (0)