polars.Series.dt.nanosecond#

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

Extract the nanoseconds from the underlying DateTime representation.

Applies to Datetime columns.

Returns:
Nanosecond part as UInt32

Examples

>>> from datetime import datetime
>>> start = datetime(2001, 1, 1)
>>> stop = datetime(2001, 1, 1, 0, 0, 4)
>>> date = pl.date_range(start, stop, interval="500ms")
>>> date
shape: (9,)
Series: '' [datetime[μs]]
[
        2001-01-01 00:00:00
        2001-01-01 00:00:00.500
        2001-01-01 00:00:01
        2001-01-01 00:00:01.500
        2001-01-01 00:00:02
        2001-01-01 00:00:02.500
        2001-01-01 00:00:03
        2001-01-01 00:00:03.500
        2001-01-01 00:00:04
]
>>> date.dt.nanosecond()
shape: (9,)
Series: '' [u32]
[
        0
        500000000
        0
        500000000
        0
        500000000
        0
        500000000
        0
]