Menu

Monthly Temperature Analysis

Monthly Temperature Analysis

Since we created a month column earlier, we can calculate average temperatures for each month.

Code

monthly_temp = (

df.groupby('Month')['Temperature (C)']

.mean()

)

print(monthly_temp)

Explanation

The groupby() function groups observations by month and calculates the average temperature for each group.

Insight

Monthly averages help reveal seasonal temperature trends and weather cycles.