MayureshShilotri / 26-Weeks-Of-Data-Science

Email Newsletter
354 stars 581 forks source link

Week 4 - .mean() error #5

Open arpit-omprakash opened 4 years ago

arpit-omprakash commented 4 years ago

the code in the mean_temperatures is wrong: 0 # One Solution 1 mean_temperatures = {} 2 3 for month in range(1, 13): 4 mean_temperatures[month] = weather_df.loc[weather_df['Date/Time'].dt.month == month, 'Temp (C)'].mean() 5 6 pd.Series(mean_temperatures)

Code in line 4 should be: mean_temperatures[month] = weather_df.loc[pd.to_datetime(weather_df['Date/Time']).dt.month == month, 'Temp (C)'].mean()