如何比较熊猫数据框中的值

时间:2020-04-30 12:45:26

标签: python-3.x pandas numpy dataframe

假设A是一个数据框,表示奥运会中所有国家的数据如何。

我正在尝试打印最大数量为:(summer_gold-winter_gold)/总金数的所有国家/地区的数据。

请检查我的代码,然后让我在这里做错了。

def answer_three():
    count=A['Gold'].count() + A['Gold.1'].count()  #Gold is no. of summer gold & Gold.1 is winter gold
    X=(((A['Gold']-A['Gold.1']).abs())/count).max() 
    Y=A.where(((A['Gold']-A['Gold.1'].abs())/count).max() == X)
    return Y
answer_three()

我遇到的错误是:

"Array conditional must be same shape as self"

0 个答案:

没有答案