@@ -204,15 +204,6 @@ def test_setitem_list_of_tuples(self, float_frame):
204
204
expected = Series (tuples , index = float_frame .index , name = "tuples" )
205
205
tm .assert_series_equal (result , expected )
206
206
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
-
216
207
def test_setitem_mulit_index (self ):
217
208
# GH7655, test that assigning to a sub-frame of a frame
218
209
# with multi-index columns aligns both rows and columns
@@ -3858,6 +3849,16 @@ def test_assigning_ops(self):
3858
3849
df .loc [2 :3 , "b" ] = Categorical (["b" , "b" ], categories = ["a" , "b" ])
3859
3850
tm .assert_frame_equal (df , exp )
3860
3851
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
+
3861
3862
def test_functions_no_warnings (self ):
3862
3863
df = DataFrame ({"value" : np .random .randint (0 , 100 , 20 )})
3863
3864
labels = ["{0} - {1}" .format (i , i + 9 ) for i in range (0 , 100 , 10 )]
0 commit comments