pandas 1.4.2

Returns
total_seconds(self) -> 'np.ndarray'

This method is available directly on TimedeltaArray, TimedeltaIndex and on Series containing timedelta values under the .dt namespace.

Returns

seconds : [ndarray, Float64Index, Series]

When the calling object is a TimedeltaArray, the return type is ndarray. When the calling object is a TimedeltaIndex, the return type is a Float64Index. When the calling object is a Series, the return type is Series of type :None:None:`float64` whose index is the same as the original.

Return total duration of each element expressed in seconds.

See Also

TimedeltaIndex.components

Return a DataFrame with components of each Timedelta.

datetime.timedelta.total_seconds

Standard library version of this method.

Examples

Series

This example is valid syntax, but we were not able to check execution
>>> s = pd.Series(pd.to_timedelta(np.arange(5), unit='d'))
... s 0 0 days 1 1 days 2 2 days 3 3 days 4 4 days dtype: timedelta64[ns]
This example is valid syntax, but we were not able to check execution
>>> s.dt.total_seconds()
0         0.0
1     86400.0
2    172800.0
3    259200.0
4    345600.0
dtype: float64

TimedeltaIndex

This example is valid syntax, but we were not able to check execution
>>> idx = pd.to_timedelta(np.arange(5), unit='d')
... idx TimedeltaIndex(['0 days', '1 days', '2 days', '3 days', '4 days'], dtype='timedelta64[ns]', freq=None)
This example is valid syntax, but we were not able to check execution
>>> idx.total_seconds()
Float64Index([0.0, 86400.0, 172800.0, 259200.00000000003, 345600.0],
             dtype='float64')
See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /pandas/core/arrays/timedeltas.py#808
type: <class 'function'>
Commit: