Beispiel #1
0
def q04_country_with_most_gold_medals(path):
    'write your solution here'
    df = q03_summer_gold_medals(path)
    
    df['Max_Gold'] = pd.DataFrame(df.iloc[:,1].astype('int64')) + pd.DataFrame(df.iloc[:,6].astype('int64'))
    
    return df['Max_Gold'].idxmax()
Beispiel #2
0
def q04_country_with_most_gold_medals(path):
    df = q03_summer_gold_medals(path)
    dfnew = df['Gold']
    total_column = (dfnew.iloc[:, 2:3])
    top_max = total_column.loc[df['Gold'].idxmax()]
    top = (top_max).index[0].replace("\xc2\xa0", "")
    return top
Beispiel #3
0
def q04_country_with_most_gold_medals(path):
    'write your solution here'
    df = q03_summer_gold_medals(path)
    df1 = df.loc[:,'Gold']
    df1.iloc[:,:] = df1.iloc[:,:].apply(pd.to_numeric)
    df2 = df1.iloc[:,:].sum(axis=1)
    return df2[df2 == df2.max()].index[0]
Beispiel #4
0
def q04_country_with_most_gold_medals(path):
    "write your solution here"
    df = q03_summer_gold_medals(path)
    gold_count = df.iloc[:, 1].sort_values(ascending=False)
    max_gold_count = gold_count[:1].index
    country_name = max_gold_count[0]
    country_with_most_gold_medals = country_name.replace('\xc2\xa0', "")
    return country_with_most_gold_medals
Beispiel #5
0
def q04_country_with_most_gold_medals(path):
    df = q03_summer_gold_medals(path)
    df_gold_count = df.iloc[:, [1, 6, 11]]
    df_gold_count = df_gold_count.astype('int')
    df_gold_count['Total'] = df_gold_count.sum(axis=1)
    df_gold_final = df_gold_count.iloc[:, -1].reset_index()
    df_gold_final = df_gold_final[df_gold_final['Total'] ==
                                  df_gold_final.Total.max()]
    return df_gold_final.iloc[0, 0]
Beispiel #6
0
def q04_country_with_most_gold_medals(path):
    'write your solution here'
    df = q03_summer_gold_medals(path)
    gold_count = df.iloc[:, 1].sort_values(ascending=False)

    df['gold_count'] = gold_count
    max = gold_count.max()
    a = df[df['gold_count'] == max]
    aa = a.index
    aaa = aa[0]
    return aaa
Beispiel #7
0
def q04_country_with_most_gold_medals(path):
    "write your solution here"
    df = q03_summer_gold_medals(path)
    return (df.index[df.iloc[:, 11] == max(df.iloc[:, 11])][0])
Beispiel #8
0
def q04_country_with_most_gold_medals(path):
    "write your solution here"
    df = q03_summer_gold_medals(path)
    return df.iloc[:, 2].idxmax()
Beispiel #9
0
def q04_country_with_most_gold_medals(path):
    'write your solution here'
    df = q03_summer_gold_medals(path)
    df1 = df.iloc[1:, [1, 6, 11]].astype(int).sum(axis=1).sort_values(
        ascending=False).reset_index()
    return df1['country name'][0].replace('\xa0', '')
Beispiel #10
0
def q04_country_with_most_gold_medals(path):
    "write your solution here"
    df = q03_summer_gold_medals(path)
    return "Srilanka"