Skip to content

Commit 8564cff

Browse files
committed
Revert "add iso-format support to to_timedelta"
This reverts commit 3f5f176.
1 parent 3f5f176 commit 8564cff

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

pandas/_libs/tslibs/timedeltas.pyx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,7 @@ cpdef convert_to_timedelta64(object ts, object unit):
183183
ts = cast_from_unit(ts, unit)
184184
ts = np.timedelta64(ts)
185185
elif is_string_object(ts):
186-
if len(ts) > 0 and ts[0] == 'P':
187-
ts = np.timedelta64(parse_iso_format_string(ts))
188-
else:
189-
ts = np.timedelta64(parse_timedelta_string(ts))
186+
ts = np.timedelta64(parse_timedelta_string(ts))
190187
elif hasattr(ts, 'delta'):
191188
ts = np.timedelta64(delta_to_nanoseconds(ts), 'ns')
192189

pandas/io/json/table_schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import warnings
77

88
import pandas._libs.json as json
9-
from pandas import DataFrame, to_timedelta
9+
from pandas import DataFrame, Timedelta
1010
from pandas.api.types import CategoricalDtype
1111
import pandas.core.common as com
1212
from pandas.core.dtypes.common import (
@@ -308,7 +308,7 @@ def parse_table_schema(json, precise_float):
308308

309309
for col, dtype in dtypes.items():
310310
if dtype == 'timedelta64[ns]':
311-
df[col] = to_timedelta(df[col])
311+
df[col] = df[col].apply(Timedelta)
312312

313313
df = df.astype(dtypes)
314314

0 commit comments

Comments
 (0)