Mean, Median, and mode of a list of values (SCORE) given a certain zip code for every year

前端 未结 2 450
春和景丽
春和景丽 2021-01-29 04:57

I want to find the mean, median and mode value for each year given a specific ZIP code how can I achieve this, I already read the data from CSV file and convert it to json file

2条回答
  •  时光取名叫无心
    2021-01-29 05:32

    you could use groupby to group the data by date and zipcode and then use the .agg function to apply the mean, median and mode to it. The code would look as follow

    groupedData = df.groupby(["DATE","Zip codes"]).agg({"Score" : ["mean","median","mode"]
    

提交回复
热议问题