polars.internals.series.datetime.DateTimeNameSpace.seconds#

DateTimeNameSpace.seconds() Series[source]#

Extract the seconds from a Duration type.

Returns:
A series of dtype Int64

Examples

>>> from datetime import datetime
>>> date = pl.date_range(
...     datetime(2020, 1, 1), datetime(2020, 1, 1, 0, 4, 0), "1m"
... )
>>> date
shape: (5,)
Series: '' [datetime[μs]]
[
        2020-01-01 00:00:00
        2020-01-01 00:01:00
        2020-01-01 00:02:00
        2020-01-01 00:03:00
        2020-01-01 00:04:00
]
>>> date.diff().dt.seconds()
shape: (5,)
Series: '' [i64]
[
        null
        60
        60
        60
        60
]