中级
综合:学习数据多格式导出
未完成
中级参考
代码结构已给出,请填写 ____ 处
def solve():
from pyodide.http import open_url
from io import StringIO
import pandas as pd, json
cards=pd.read_csv(StringIO(open_url(____).read()))
scheds=pd.read_csv(StringIO(open_url(____).read()))
uid=cards['____'].value_counts().index[____]
uc=cards[cards['____']==uid].head(____)
us=scheds[scheds['____']==uid][['____','____','____']].head(____)
merged=uc.merge(____)
data=[{'____':r['____'][:____],'____':r['____'][:____],'____':r['____'],'____':r.get(____)} for _,r in merged.iterrows()]
print(____)
print(json.dumps({'____':uid,'____':len(____),'____':data[:____]},ensure_ascii=False)[:____]+"____")
print(____)
for d in data[:____]: print(____)
示例
输入
solve()
期望输出
[JSON export]
{"user": "USR-0011", "total": 139, "sample": [{"front": "What is the capital of France?", "back": "Paris", "type": "qa", "status": "new"}, {"front": "What is the speed of light?", "back": "299,792,458...
[CSV export]
What is the capital of France?,qa,new
What is the speed of light?,qa,review
Who wrote "Pride and Prejudice"?,qa,learning
👑
升级 VIP
解锁全部题目,畅通无阻地学习
- ✓ 解锁全部训练包所有题目
- ✓ 查看完整参考代码和提示
- ✓ 浏览器内直接运行 Python 代码
- ✓ 自动批改 + 进度追踪
30天
¥18
1年
¥99
2年
¥158
3年
¥199