Here is the answer that worked for me:
def answer_five():
return census_df.groupby(["STNAME"],sort=False).sum()["COUNTY"].idxmax()
First part created aggregated df
census_df.groupby(["STNAME"],sort=False).sum()
Second part takes the col you need
["COUNTY"].idxmax()
and returns value corresponding to index with max, check here
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…