polars.Series.dt.day#
- Series.dt.day() Series [source]#
Extract the day from the underlying date representation.
Applies to Date and Datetime columns.
Returns the day of month starting from 1. The return value ranges from 1 to 31. (The last day of month differs by months.)
- Returns:
- Series
Series of data type
UInt32
.
Examples
>>> from datetime import datetime >>> start = datetime(2001, 1, 1) >>> stop = datetime(2001, 1, 9) >>> date = pl.date_range(start, stop, interval="2d", eager=True) >>> date shape: (5,) Series: 'date' [datetime[μs]] [ 2001-01-01 00:00:00 2001-01-03 00:00:00 2001-01-05 00:00:00 2001-01-07 00:00:00 2001-01-09 00:00:00 ] >>> date.dt.day() shape: (5,) Series: 'date' [u32] [ 1 3 5 7 9 ]