File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -163,7 +163,7 @@ def __new__(
163
163
"represent unambiguous timedelta values durations."
164
164
)
165
165
166
- if isinstance (data , TimedeltaArray ):
166
+ if isinstance (data , TimedeltaArray ) and freq is None :
167
167
if copy :
168
168
data = data .copy ()
169
169
return cls ._simple_new (data , name = name , freq = freq )
Original file line number Diff line number Diff line change @@ -47,6 +47,12 @@ def test_infer_from_tdi_mismatch(self):
47
47
# GH#23789
48
48
TimedeltaArray (tdi , freq = "D" )
49
49
50
+ with pytest .raises (ValueError , match = msg ):
51
+ TimedeltaIndex (tdi ._data , freq = "D" )
52
+
53
+ with pytest .raises (ValueError , match = msg ):
54
+ TimedeltaArray (tdi ._data , freq = "D" )
55
+
50
56
def test_dt64_data_invalid (self ):
51
57
# GH#23539
52
58
# passing tz-aware DatetimeIndex raises, naive or ndarray[datetime64]
You can’t perform that action at this time.
0 commit comments