polars.Series.dt.nanoseconds#

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

Extract the nanoseconds 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, 0, 1, 0),
...     "1ms",
...     eager=True,
... )[:3]
>>> date
shape: (3,)
Series: 'date' [datetime[μs]]
[
        2020-01-01 00:00:00
        2020-01-01 00:00:00.001
        2020-01-01 00:00:00.002
]
>>> date.diff().dt.nanoseconds()
shape: (3,)
Series: 'date' [i64]
[
        null
        1000000
        1000000
]