初级
综合买卖次数找出平台最活跃用户
未完成
初级参考
完整示例代码供参考,建议自己理解后重新输入
def solve():
from pyodide.http import open_url
from io import StringIO
import pandas as pd
user_stats=pd.read_csv(StringIO(open_url("https://data.zuihe.com/dbd/ms-campustrade/state_04/user_stats.csv").read()))
user_stats['activity_score']=user_stats['buy_count']+user_stats['sell_count']
print("Top 5 most active users:")
for _,r in user_stats.nlargest(5,'activity_score').iterrows():
print(f" {r['name']}: buy={r['buy_count']} sell={r['sell_count']} credit={r['credit_score']} score={r['activity_score']}")
示例
输入
solve()
期望输出
Top 5 most active users: 何勇: buy=2 sell=4 credit=78 score=6 徐敏: buy=4 sell=1 credit=80 score=5 孙超: buy=2 sell=3 credit=89 score=5 胡涛: buy=3 sell=1 credit=100 score=4 罗平: buy=3 sell=0 credit=93 score=3
👑
升级 VIP
解锁全部题目,畅通无阻地学习
- ✓ 解锁全部训练包所有题目
- ✓ 查看完整参考代码和提示
- ✓ 浏览器内直接运行 Python 代码
- ✓ 自动批改 + 进度追踪
30天
¥18
1年
¥99
2年
¥158
3年
¥199