Format Timedelta as ISO 8601 Duration like P[n]Y[n]M[n]DT[n]H[n]M[n]S, where the [n] s are replaced by the values. See

New in version 0.20.0.

formatted : str


The longest component is days, whose value may be larger than 365. Every component is always included, even if its value is 0. Pandas uses nanosecond precision, so up to 9 decimal places may be included in the seconds component. Trailing 0’s are removed from the seconds component after the decimal. We do not 0 pad components, so it’s …T5H…, not …T05H…


>>> td = pd.Timedelta(days=6, minutes=50, seconds=3,
...                   milliseconds=10, microseconds=10, nanoseconds=12)
>>> td.isoformat()
>>> pd.Timedelta(hours=1, seconds=10).isoformat()
>>> pd.Timedelta(hours=1, seconds=10).isoformat()
>>> pd.Timedelta(days=500.5).isoformat()
Scroll To Top