@@ -80,6 +80,30 @@ def test_where(self, closed, klass):
80
80
result = idx .where (klass (cond ))
81
81
tm .assert_index_equal (result , expected )
82
82
83
+ @pytest .mark .parametrize ("tz" , ["US/Pacific" , None ])
84
+ def test_putmask_dt64 (self , tz ):
85
+ # GH#37968
86
+ dti = date_range ("2016-01-01" , periods = 9 , tz = tz )
87
+ idx = IntervalIndex .from_breaks (dti )
88
+ mask = np .zeros (idx .shape , dtype = bool )
89
+ mask [0 :3 ] = True
90
+
91
+ result = idx .putmask (mask , idx [- 1 ])
92
+ expected = IntervalIndex ([idx [- 1 ]] * 3 + list (idx [3 :]))
93
+ tm .assert_index_equal (result , expected )
94
+
95
+ def test_putmask_td64 (self ):
96
+ # GH#37968
97
+ dti = date_range ("2016-01-01" , periods = 9 )
98
+ tdi = dti - dti [0 ]
99
+ idx = IntervalIndex .from_breaks (tdi )
100
+ mask = np .zeros (idx .shape , dtype = bool )
101
+ mask [0 :3 ] = True
102
+
103
+ result = idx .putmask (mask , idx [- 1 ])
104
+ expected = IntervalIndex ([idx [- 1 ]] * 3 + list (idx [3 :]))
105
+ tm .assert_index_equal (result , expected )
106
+
83
107
def test_getitem_2d_deprecated (self ):
84
108
# GH#30588 multi-dim indexing is deprecated, but raising is also acceptable
85
109
idx = self .create_index ()
0 commit comments