Please note, this is a STATIC archive of website www.w3resource.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
w3resource

Pandas Series: dt.to_pytimedelta() function

Series-dt.to_pytimedelta() function

The dt.to_pytimedelta() function is used to return an array of native datetime.timedelta objects.

Python's standard datetime library uses a different representation timedelta’s. This method converts a Series of pandas Timedeltas to datetime.timedelta format with the same length as the original Series.

Syntax:

Series.dt.to_pytimedelta(self)
Pandas Series: dt.to_pytimedelta() function

Returns: a : numpy.ndarray
Array of 1D containing data with datetime.timedelta type.

Example:


Download the Pandas Series Notebooks from here.

Previous: Series-dt.components() function
Next: Series-dt.total_seconds() function