@@ -274,6 +274,42 @@ 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" ])
278
+ def test_concat_series_columns_nonoverlap_5min_units (self , unit ):
279
+ # GH#58471 minimal reproducible example
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" ])
290
+ def test_concat_series_columns_month_end_units_order_insensitive (self , unit ):
291
+ # GH#58471 minimal reproducible example
292
+ idx1 = date_range (start = "2015-01-31" , end = "2016-01-31" , freq = "ME" , unit = unit )
293
+ idx2 = date_range (
294
+ start = "2015-02-28" , end = "2016-02-29" , freq = "ME" , unit = unit
295
+ ) # fixed leap-year issue
296
+ s1 = Series (np .arange (len (idx1 )), index = idx1 , name = "m1" )
297
+ s2 = Series (np .arange (len (idx2 )), index = idx2 , name = "m2" )
298
+ df1 = concat ([s1 , s2 ], axis = 1 ).sort_index ()
299
+ df2 = concat ([s2 , s1 ], axis = 1 ).sort_index ()
300
+
301
+ result = df1 .index
302
+ expected = date_range (
303
+ start = min (idx1 [0 ], idx2 [0 ]),
304
+ end = max (idx1 [- 1 ], idx2 [- 1 ]),
305
+ freq = "ME" ,
306
+ unit = unit ,
307
+ )
308
+ tm .assert_index_equal (result , expected )
309
+
310
+ result = df2 .index
311
+ tm .assert_index_equal (result , expected )
312
+
277
313
278
314
class TestTimezoneConcat :
279
315
def test_concat_tz_series (self ):
0 commit comments