Skip to content

Commit 5d47754

Browse files
committed
Move test to TestDataFrameIndexingCategorical, add issue number
1 parent c945ab1 commit 5d47754

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

pandas/tests/frame/test_indexing.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -204,15 +204,6 @@ def test_setitem_list_of_tuples(self, float_frame):
204204
expected = Series(tuples, index=float_frame.index, name="tuples")
205205
tm.assert_series_equal(result, expected)
206206

207-
def test_setitem_single_row_categorical(self):
208-
df = DataFrame({"Alpha": ["a"], "Numeric": [0]})
209-
categories = pd.Categorical(df["Alpha"], categories=["a", "b", "c"])
210-
df.loc[:, "Alpha"] = categories
211-
212-
result = df["Alpha"]
213-
expected = Series(categories, index=df.index, name="Alpha")
214-
tm.assert_series_equal(result, expected)
215-
216207
def test_setitem_mulit_index(self):
217208
# GH7655, test that assigning to a sub-frame of a frame
218209
# with multi-index columns aligns both rows and columns
@@ -3858,6 +3849,16 @@ def test_assigning_ops(self):
38583849
df.loc[2:3, "b"] = Categorical(["b", "b"], categories=["a", "b"])
38593850
tm.assert_frame_equal(df, exp)
38603851

3852+
def test_setitem_single_row_categorical(self):
3853+
# GH 25495
3854+
df = DataFrame({"Alpha": ["a"], "Numeric": [0]})
3855+
categories = pd.Categorical(df["Alpha"], categories=["a", "b", "c"])
3856+
df.loc[:, "Alpha"] = categories
3857+
3858+
result = df["Alpha"]
3859+
expected = Series(categories, index=df.index, name="Alpha")
3860+
tm.assert_series_equal(result, expected)
3861+
38613862
def test_functions_no_warnings(self):
38623863
df = DataFrame({"value": np.random.randint(0, 100, 20)})
38633864
labels = ["{0} - {1}".format(i, i + 9) for i in range(0, 100, 10)]

0 commit comments

Comments
 (0)