@@ -2768,3 +2768,37 @@ def test_concat_copy_index(test_series, axis):
2768
2768
comb = concat ([df , df ], axis = axis , copy = True )
2769
2769
assert comb .index is not df .index
2770
2770
assert comb .columns is not df .columns
2771
+
2772
+
2773
+ def test_concat_multiindex_datetime_object_index ():
2774
+ # https://github.com/pandas-dev/pandas/issues/11058
2775
+ s = Series (
2776
+ ["a" , "b" ],
2777
+ index = MultiIndex .from_arrays (
2778
+ [[1 , 2 ], Index ([dt .date (2013 , 1 , 1 ), dt .date (2014 , 1 , 1 )], dtype = "object" )],
2779
+ names = ["first" , "second" ],
2780
+ ),
2781
+ )
2782
+ s2 = Series (
2783
+ ["a" , "b" ],
2784
+ index = MultiIndex .from_arrays (
2785
+ [[1 , 2 ], Index ([dt .date (2013 , 1 , 1 ), dt .date (2015 , 1 , 1 )], dtype = "object" )],
2786
+ names = ["first" , "second" ],
2787
+ ),
2788
+ )
2789
+ expected = DataFrame (
2790
+ [["a" , "a" ], ["b" , np .nan ], [np .nan , "b" ]],
2791
+ index = MultiIndex .from_arrays (
2792
+ [
2793
+ [1 , 2 , 2 ],
2794
+ DatetimeIndex (
2795
+ ["2013-01-01" , "2014-01-01" , "2015-01-01" ],
2796
+ dtype = "datetime64[ns]" ,
2797
+ freq = None ,
2798
+ ),
2799
+ ],
2800
+ names = ["first" , "second" ],
2801
+ ),
2802
+ )
2803
+ result = concat ([s , s2 ], axis = 1 )
2804
+ tm .assert_frame_equal (result , expected )
0 commit comments