polars.internals.series.datetime.DateTimeNameSpace.days#

DateTimeNameSpace.days() Series[source]#

Extract the days from a Duration type.

Returns:
A series of dtype Int64

Examples

>>> from datetime import datetime
>>> date = pl.date_range(datetime(2020, 3, 1), datetime(2020, 5, 1), "1mo")
>>> date
shape: (3,)
Series: '' [datetime[μs]]
[
        2020-03-01 00:00:00
        2020-04-01 00:00:00
        2020-05-01 00:00:00
]
>>> date.diff().dt.days()
shape: (3,)
Series: '' [i64]
[
        null
        31
        30
]