Max value using idxmax

前端 未结 8 1444
情歌与酒
情歌与酒 2020-12-22 04:55

I am trying to calculate the biggest difference between summer gold medal counts and winter gold medal counts relative to their total gold medal count. The problem is that

8条回答
  •  情话喂你
    2020-12-22 05:33

    This looks like a question from the programming assignment of courser course - "Introduction to Data Science in Python"

    Having said that if you are not cheating "maybe" the bug is here:

    Gold_Y = df2[(df2['Gold'] > 1) | (df2['Gold.1'] > 1)]
    

    You should use the & operator. The | operator means you have countries that have won Gold in either the Summer or Winter olympics.

    You should not get a NaN in your diff gold.

提交回复
热议问题