pandas.Timedelta.to_timedelta64#

Timedelta.to_timedelta64()#

Return a numpy.timedelta64 object with ‘ns’ precision.

Since NumPy uses timedelta64 objects for its time operations, converting a pandas Timedelta into a NumPy timedelta64 provides seamless integration between the two libraries, especially when working in environments that heavily rely on NumPy for array-based calculations.

See also

to_timedelta

Convert argument to timedelta.

numpy.timedelta64

A NumPy object for time duration.

Timedelta

Represents a duration, the difference between two dates or times.

Examples

>>> td = pd.Timedelta('3D')
>>> td
Timedelta('3 days 00:00:00')
>>> td.to_timedelta64()
numpy.timedelta64(259200000000000,'ns')