【发布时间】:2019-04-21 16:03:28
【问题描述】:
我需要在 csv 文件的列中打印出现次数最多的赛道名称。
我试过这个:
popular_course = (race_data.groupby(race_data.Race_Course.tolist(),as_index=False).size())
print(popular_course)
我的输出是:
Aintree 3
Ayr 6
Fairyhouse 3
Punchestown 3
Sandown 3
dtype: int64
当我把打印功能改成这样的时候:
print(popular_course.max())
我明白了:
6
我还需要打印函数来打印赛马场的名称,使它看起来像这样:
Ayr 6
如何让它包含赛马场的名称?
【问题讨论】: