Menu

Extracting Month Information

Extracting Month Information

Weather patterns often vary by month.

To simplify monthly analysis, we create a new month column.

Code

df['Month'] = df['Formatted date'].dt.month

Explanation

The new column stores the month number for each observation.

Example:

Date

Month

2024-01-151
2024-07-207
2024-12-0512

This feature helps analyze seasonal weather patterns.