@@ -413,6 +413,38 @@ def test_replace_only_one_dictlike_arg(self):
413
413
),
414
414
(pd .Series ([1 , 2 ], dtype = "int64" ), {1 : 10 , 2 : 20 }, "int64" ),
415
415
(pd .Series ([True , False ], dtype = "bool" ), {True : False }, "bool" ),
416
+ (
417
+ pd .Series (pd .interval_range (0 , 5 ), dtype = pd .IntervalDtype ("int64" )),
418
+ {pd .Interval (0 , 1 ): pd .Interval (10 , 20 )},
419
+ "interval[int64]" ,
420
+ ),
421
+ (
422
+ pd .Series (pd .interval_range (0 , 1 ), dtype = pd .IntervalDtype ("float64" )),
423
+ {pd .Interval (0.0 , 1.0 ): pd .Interval (0.2 , 0.3 )},
424
+ "interval[float64]" ,
425
+ ),
426
+ (
427
+ pd .Series ([pd .Period ("2020-05" , freq = "M" )], dtype = pd .PeriodDtype ("M" )),
428
+ {pd .Period ("2020-05" , freq = "M" ): pd .Period ("2020-06" , freq = "M" )},
429
+ "period[M]" ,
430
+ ),
431
+ (
432
+ pd .Series (
433
+ pd .arrays .DatetimeArray (
434
+ np .array (
435
+ ["2000-01-01T12:00:00" , "2000-01-02T12:00:00" ],
436
+ dtype = "M8[ns]" ,
437
+ ),
438
+ dtype = pd .DatetimeTZDtype (tz = "US/Central" ),
439
+ )
440
+ ),
441
+ {
442
+ pd .Timestamp (
443
+ "2000-01-01 06:00:00-0600" , tz = "US/Central"
444
+ ): pd .Timestamp ("2000-01-01 12:00:00-0600" , tz = "US/Central" )
445
+ },
446
+ "datetime64[ns, US/Central]" ,
447
+ ),
416
448
],
417
449
)
418
450
def test_replace_dtype (self , series , to_replace , expected ):
0 commit comments