polars.Series.dt.seconds#

Series.dt.seconds() Series[source]#

Extract the seconds from a Duration type.

Returns:
Series

Series of data type Int64.

Examples

>>> from datetime import datetime
>>> date = pl.date_range(
...     datetime(2020, 1, 1), datetime(2020, 1, 1, 0, 4, 0), "1m", eager=True
... )
>>> date
shape: (5,)
Series: 'date' [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: 'date' [i64]
[
        null
        60
        60
        60
        60
]