pandas.Timedelta

class pandas.Timedelta

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

Timedelta is the pandas equivalent of python’s datetime.timedelta and is interchangeable with it in most cases.

Parameters:
value : Timedelta, timedelta, np.timedelta64, string, or integer

unit : string, {‘ns’, ‘us’, ‘ms’, ‘s’, ‘m’, ‘h’, ‘D’}, optional

Denote the unit of the input, if input is an integer. Default ‘ns’.

days, seconds, microseconds,

milliseconds, minutes, hours, weeks : numeric, optional

Values for construction in compat with datetime.timedelta. np ints and floats will be coereced to python ints and floats.

Notes

The .value attribute is always in ns.

Attributes

asm8 return a numpy timedelta64 array view of myself
components Return a Components NamedTuple-like
days Number of days.
delta Return the timedelta in nanoseconds (ns), for internal compatibility.
microseconds Number of microseconds (>= 0 and less than 1 second).
nanoseconds Return the number of nanoseconds (n), where 0 <= n < 1 microsecond.
resolution return a string representing the lowest resolution that we have
seconds Number of seconds (>= 0 and less than 1 day).
freq  
is_populated  
value  

Methods

ceil return a new Timedelta ceiled to this resolution
floor return a new Timedelta floored to this resolution
isoformat 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.
round Round the Timedelta to the specified resolution
to_pytimedelta return an actual datetime.timedelta object note: we lose nanosecond resolution if any
to_timedelta64 Returns a numpy.timedelta64 object with ‘ns’ precision
total_seconds Total duration of timedelta in seconds (to ns precision)
view array view compat
Scroll To Top