Skip to content

LazyColumn.dt.weekday

weekday

weekday() -> LazyColumn

Returns the day of the week for each datetime value (1 to 7).

Note

The dayofweek function in DuckDB returns 1 for Monday through 7 for Sunday.

Returns:

Name Type Description
LazyColumn LazyColumn

A new LazyColumn of integer values representing the weekday, where 1=Monday, 7=Sunday.

Examples:

print(df.head())
#              my_datetime_column
# 0  2023-01-02 00:00:00  # Monday
# 1  2023-01-03 12:34:56  # Tuesday
# 2  2023-01-07 23:59:59  # Saturday
# 3  2023-01-08 08:00:00  # Sunday

df["my_datetime_column"].dt.weekday
# [1, 2, 6, 7, ...]