@@ -2747,14 +2747,18 @@ def test_concat_categorical_tz():
2747
2747
tm .assert_series_equal (result , expected )
2748
2748
2749
2749
2750
- def test_concat_categorical_unch ():
2750
+ def test_concat_categorical_unchanged ():
2751
2751
# GH-12007
2752
- df1 = pd .DataFrame (pd .Series (["a" , "b" , "c" ], dtype = "category" ))
2753
- s1 = pd .Series ([0 , 1 , 2 ], index = [0 , 1 , 3 ])
2754
- df2 = pd .concat ([df1 , s1 ], axis = 1 )
2755
- result = df2 .dtypes
2756
- expected = pd .Series (["category" , "float64" ], index = [0 , 0 ])
2757
- tm .assert_series_equal (result , expected )
2752
+ df = pd .DataFrame (pd .Series (["a" , "b" , "c" ], dtype = "category" , name = "A" ))
2753
+ ser = pd .Series ([0 , 1 , 2 ], index = [0 , 1 , 3 ], name = "B" )
2754
+ result = pd .concat ([df , ser ], axis = 1 )
2755
+ expected = pd .DataFrame (
2756
+ {
2757
+ "A" : pd .Series (["a" , "b" , "c" , np .nan ], dtype = "category" ),
2758
+ "B" : pd .Series ([0 , 1 , np .nan , 2 ], dtype = "float" ),
2759
+ }
2760
+ )
2761
+ tm .assert_equal (result , expected )
2758
2762
2759
2763
2760
2764
def test_concat_datetimeindex_freq ():
0 commit comments