初级
加载卡片库并统计类型分布
未完成
初级参考
完整示例代码供参考,建议自己理解后重新输入
def solve():
from pyodide.http import open_url
from io import StringIO
import pandas as pd
cards=pd.read_csv(StringIO(open_url("https://data.zuihe.com/dbd/ms-memcard/state_00/cards.csv").read()))
print(f"Total cards: {len(cards)}")
print(f"By type: {dict(cards.groupby('card_type').size())}")
print(f"By topic: {dict(cards.groupby('tags').size().nlargest(5))}")
print(f"Users: {cards['user_id'].nunique()}")
print(f"Decks: {cards['deck_id'].nunique()}")
print(f"From materials: {len(cards[cards['source_material_id']!=''])} ({round(len(cards[cards['source_material_id']!=''])/len(cards)*100,1)}%)")
示例
输入
solve()
期望输出
Total cards: 1852
By type: {'cloze': np.int64(438), 'qa': np.int64(1414)}
By topic: {'programming': np.int64(417), 'en_vocab': np.int64(206), 'math': np.int64(201), 'ja_vocab': np.int64(182), 'es_vocab': np.int64(150)}
Users: 20
Decks: 65
From materials: 1852 (100.0%)
👑
升级 VIP
解锁全部题目,畅通无阻地学习
- ✓ 解锁全部训练包所有题目
- ✓ 查看完整参考代码和提示
- ✓ 浏览器内直接运行 Python 代码
- ✓ 自动批改 + 进度追踪
30天
¥18
1年
¥99
2年
¥158
3年
¥199