I'm using groupby sum and I am getting the wrong output:

Although the medal column only contains value of either 0 or 1, I am getting this output after executing the following code.
test=oly_new.groupby(['Country','Year'])['Medal'].sum()

I'm using groupby sum and I am getting the wrong output:

Although the medal column only contains value of either 0 or 1, I am getting this output after executing the following code.
test=oly_new.groupby(['Country','Year'])['Medal'].sum()

Your Medal column is a str, convert first to int and then sum:
oly_new['Medal'] = oly_new['Medal'].astype(int)
test=oly_new.groupby(['Country','Year'])['Medal'].sum()
When your column dtype is str then the sum function just concatenates all the strings