Menu

Extracting Day Information

Extracting Day Information

Similarly, we can extract the day component from the date.

Code

df['day'] = df['Formatted date'].dt.day

Explanation

This creates a new column containing the day of the month.

Example:

Date

Day

2024-01-1515
2024-07-2020

This feature can be useful when studying daily weather variations.