Question: Inside of Pandas for Python - For each name, calculate the average snow amount per month. The results should have name, snow(average amount), month. Save

Inside of Pandas for Python - For each name, calculate the average snow amount per month. The results should have name, snow(average amount), month. Save the results in two separate .csv files (one for 2016 and the other for 2017) name the files average2016.csv and average2017.csv.

I have:

snow2016 = df2016.groupby(['NAME',])[['SNOW']].average()

snow2016.to_csv(r'C:/Users/User/Desktop/average2016.csv')

snow2017 = df2017.groupby(['NAME',])[['SNOW']].average()

snow2017.to_csv(r'C:/Users/User/Desktop/average2017.csv')

How do I include the month in here?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!