@@ -495,7 +495,7 @@ def test_concat_categorical(self):
495
495
s1 = pd .Series ([10 , 11 , np .nan ], dtype = 'category' )
496
496
s2 = pd .Series ([np .nan , 1 , 3 , 2 ], dtype = 'category' )
497
497
498
- exp = pd .Series ([10 , 11 , np .nan , np .nan , 1 , 3 , 2 ])
498
+ exp = pd .Series ([10 , 11 , np .nan , np .nan , 1 , 3 , 2 ], dtype = 'object' )
499
499
tm .assert_series_equal (pd .concat ([s1 , s2 ], ignore_index = True ), exp )
500
500
tm .assert_series_equal (s1 .append (s2 , ignore_index = True ), exp )
501
501
@@ -515,12 +515,12 @@ def test_concat_categorical_coercion(self):
515
515
s1 = pd .Series ([1 , 2 , np .nan ], dtype = 'category' )
516
516
s2 = pd .Series ([2 , 1 , 2 ])
517
517
518
- exp = pd .Series ([1 , 2 , np .nan , 2 , 1 , 2 ])
518
+ exp = pd .Series ([1 , 2 , np .nan , 2 , 1 , 2 ], dtype = 'object' )
519
519
tm .assert_series_equal (pd .concat ([s1 , s2 ], ignore_index = True ), exp )
520
520
tm .assert_series_equal (s1 .append (s2 , ignore_index = True ), exp )
521
521
522
522
# result shouldn't be affected by 1st elem dtype
523
- exp = pd .Series ([2 , 1 , 2 , 1 , 2 , np .nan ])
523
+ exp = pd .Series ([2 , 1 , 2 , 1 , 2 , np .nan ], dtype = 'object' )
524
524
tm .assert_series_equal (pd .concat ([s2 , s1 ], ignore_index = True ), exp )
525
525
tm .assert_series_equal (s2 .append (s1 , ignore_index = True ), exp )
526
526
@@ -540,11 +540,11 @@ def test_concat_categorical_coercion(self):
540
540
s1 = pd .Series ([10 , 11 , np .nan ], dtype = 'category' )
541
541
s2 = pd .Series ([1 , 3 , 2 ])
542
542
543
- exp = pd .Series ([10 , 11 , np .nan , 1 , 3 , 2 ])
543
+ exp = pd .Series ([10 , 11 , np .nan , 1 , 3 , 2 ], dtype = 'object' )
544
544
tm .assert_series_equal (pd .concat ([s1 , s2 ], ignore_index = True ), exp )
545
545
tm .assert_series_equal (s1 .append (s2 , ignore_index = True ), exp )
546
546
547
- exp = pd .Series ([1 , 3 , 2 , 10 , 11 , np .nan ])
547
+ exp = pd .Series ([1 , 3 , 2 , 10 , 11 , np .nan ], dtype = 'object' )
548
548
tm .assert_series_equal (pd .concat ([s2 , s1 ], ignore_index = True ), exp )
549
549
tm .assert_series_equal (s2 .append (s1 , ignore_index = True ), exp )
550
550
@@ -580,11 +580,13 @@ def test_concat_categorical_3elem_coercion(self):
580
580
s2 = pd .Series ([2 , 1 , 2 ], dtype = 'category' )
581
581
s3 = pd .Series ([1 , 2 , 1 , 2 , np .nan ])
582
582
583
- exp = pd .Series ([1 , 2 , np .nan , 2 , 1 , 2 , 1 , 2 , 1 , 2 , np .nan ])
583
+ exp = pd .Series ([1 , 2 , np .nan , 2 , 1 , 2 , 1 , 2 , 1 , 2 , np .nan ],
584
+ dtype = 'object' )
584
585
tm .assert_series_equal (pd .concat ([s1 , s2 , s3 ], ignore_index = True ), exp )
585
586
tm .assert_series_equal (s1 .append ([s2 , s3 ], ignore_index = True ), exp )
586
587
587
- exp = pd .Series ([1 , 2 , 1 , 2 , np .nan , 1 , 2 , np .nan , 2 , 1 , 2 ])
588
+ exp = pd .Series ([1 , 2 , 1 , 2 , np .nan , 1 , 2 , np .nan , 2 , 1 , 2 ],
589
+ dtype = 'object' )
588
590
tm .assert_series_equal (pd .concat ([s3 , s1 , s2 ], ignore_index = True ), exp )
589
591
tm .assert_series_equal (s3 .append ([s1 , s2 ], ignore_index = True ), exp )
590
592
@@ -668,7 +670,7 @@ def test_concat_categorical_coercion_nan(self):
668
670
s1 = pd .Series ([1 , np .nan ], dtype = 'category' )
669
671
s2 = pd .Series ([np .nan , np .nan ])
670
672
671
- exp = pd .Series ([1 , np .nan , np .nan , np .nan ])
673
+ exp = pd .Series ([1 , np .nan , np .nan , np .nan ], dtype = 'object' )
672
674
tm .assert_series_equal (pd .concat ([s1 , s2 ], ignore_index = True ), exp )
673
675
tm .assert_series_equal (s1 .append (s2 , ignore_index = True ), exp )
674
676
0 commit comments