Skip to content

LazyColumn.dt.month

month property

month: LazyColumn

Extracts the month (1 to 12) from each datetime value.

Returns:

Name Type Description
LazyColumn LazyColumn

A new LazyColumn of integer values representing the month.

Examples:

print(df.head())
#              my_datetime_column
# 0  2023-01-01 00:00:00
# 1  2023-02-15 12:34:56
# 2  2023-12-31 23:59:59

df["my_datetime_column"].dt.month
# [1, 2, 12, ...]