Skip to content

Commit 7f1336c

Browse files
committed
add whatsnew entry
1 parent 7be068b commit 7f1336c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

doc/source/whatsnew/v0.24.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ Other Enhancements
121121
- :class:`IntervalIndex` has gained the :meth:`~IntervalIndex.set_closed` method to change the existing ``closed`` value (:issue:`21670`)
122122
- :func:`~DataFrame.to_csv` and :func:`~DataFrame.to_json` now support ``compression='infer'`` to infer compression based on filename (:issue:`15008`)
123123
- :func:`to_timedelta` now supports iso-formated timedelta strings (:issue:`21877`)
124+
- :func:`read_json` now parse timedelta with `orient='table'` (:issue:`21140`)
124125
-
125126

126127
.. _whatsnew_0240.api_breaking:

pandas/io/json/table_schema.py

+2-2
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, Timedelta
9+
from pandas import DataFrame, to_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] = df[col].apply(Timedelta)
311+
df[col] = to_timedelta(df[col])
312312

313313
df = df.astype(dtypes)
314314

0 commit comments

Comments
 (0)