@@ -274,6 +274,36 @@ def test_concat_NaT_series_dataframe_all_NaT(self, tz1, tz2):
274
274
result = concat ([first , second ])
275
275
tm .assert_frame_equal (result , expected )
276
276
277
+ @pytest .mark .parametrize ("unit" , ["ns" , "us" , "ms" , "s" ])
278
+ def test_concat_series_columns_nonoverlap_5min_units (self , unit ):
279
+ # GH#58471
280
+ idx1 = date_range ("2024-01-01" , periods = 24 * 12 , freq = "5min" , unit = unit )
281
+ idx2 = date_range ("2024-01-02" , periods = 24 * 12 , freq = "5min" , unit = unit )
282
+ s1 = Series (np .arange (len (idx1 )), index = idx1 , name = "a" )
283
+ s2 = Series (np .arange (len (idx2 )), index = idx2 , name = "b" )
284
+ df = concat ([s1 , s2 ], axis = 1 )
285
+ result = df .index
286
+ expected = date_range ("2024-01-01" , "2024-01-02 23:55" , freq = "5min" , unit = unit )
287
+ tm .assert_index_equal (result , expected )
288
+
289
+ @pytest .mark .parametrize ("unit" , ["ns" , "us" , "ms" , "s" ])
290
+ def test_concat_series_columns_month_end_units_order_insensitive (self , unit ):
291
+ # GH#58471
292
+ idx1 = date_range (start = "2015-01-31" , end = "2016-01-31" , freq = "ME" , unit = unit )
293
+ idx2 = date_range (start = "2015-02-28" , end = "2016-02-29" , freq = "ME" , unit = unit )
294
+ s1 = Series (np .arange (len (idx1 )), index = idx1 , name = "m1" )
295
+ s2 = Series (np .arange (len (idx2 )), index = idx2 , name = "m2" )
296
+ df1 = concat ([s1 , s2 ], axis = 1 )
297
+ df2 = concat ([s2 , s1 ], axis = 1 )
298
+
299
+ result1 = df1 .index
300
+ expected1 = idx1 .union (idx2 )
301
+ tm .assert_index_equal (result1 , expected1 )
302
+
303
+ result2 = df2 .index
304
+ expected2 = idx2 .union (idx1 )
305
+ tm .assert_index_equal (result2 , expected2 )
306
+
277
307
278
308
class TestTimezoneConcat :
279
309
def test_concat_tz_series (self ):
0 commit comments