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)
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
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework