polars.Series.dt.weekday#
- Series.dt.weekday() Series [source]#
Extract the week day from the underlying date representation.
Applies to Date and Datetime columns.
Returns the ISO weekday number where monday = 1 and sunday = 7
- Returns:
- Series
Series of data type
UInt32
.
Examples
>>> from datetime import datetime >>> start = datetime(2001, 1, 1) >>> stop = datetime(2001, 1, 7) >>> date = pl.date_range(start, stop, interval="1d", eager=True) >>> date shape: (7,) Series: 'date' [datetime[μs]] [ 2001-01-01 00:00:00 2001-01-02 00:00:00 2001-01-03 00:00:00 2001-01-04 00:00:00 2001-01-05 00:00:00 2001-01-06 00:00:00 2001-01-07 00:00:00 ] >>> date.dt.weekday() shape: (7,) Series: 'date' [u32] [ 1 2 3 4 5 6 7 ]