File tree 2 files changed +8
-7
lines changed
2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -1466,11 +1466,6 @@ def append(self, other):
1466
1466
1467
1467
typs = _concat .get_dtype_kinds (to_concat )
1468
1468
1469
- if 'category' in typs :
1470
- # if any of the to_concat is category
1471
- from pandas .indexes .category import CategoricalIndex
1472
- return CategoricalIndex ._append_same_dtype (self , to_concat , name )
1473
-
1474
1469
if len (typs ) == 1 :
1475
1470
return self ._append_same_dtype (to_concat , name = name )
1476
1471
return _concat ._concat_index_asobject (to_concat , name = name )
Original file line number Diff line number Diff line change @@ -272,11 +272,17 @@ def test_append(self):
272
272
273
273
# with objects
274
274
result = ci .append (Index (['c' , 'a' ]))
275
- expected = CategoricalIndex (list ('aabbcaca' ), categories = categories )
275
+ #expected = CategoricalIndex(list('aabbcaca'), categories=categories)
276
+ expected = Index (list ('aabbcaca' ))
276
277
tm .assert_index_equal (result , expected , exact = True )
277
278
278
279
# invalid objects
279
- self .assertRaises (TypeError , lambda : ci .append (Index (['a' , 'd' ])))
280
+ #self.assertRaises(TypeError, lambda: ci.append(Index(['a', 'd'])))
281
+
282
+ # GH14298 - if base object is not categorical -> coerce to object
283
+ result = Index (['c' , 'a' ]).append (ci )
284
+ expected = Index (list ('caaabbca' ))
285
+ tm .assert_index_equal (result , expected , exact = True )
280
286
281
287
def test_insert (self ):
282
288
You can’t perform that action at this time.
0 commit comments