← 返回题库
初级

加载并统计小票OCR结果

未完成
初级参考 完整示例代码供参考,建议自己理解后重新输入
def solve():
    from pyodide.http import open_url
    from io import StringIO
    import pandas as pd
    rcp = pd.read_csv(StringIO(open_url("https://data.zuihe.com/dbd/ms-ledger/state_01/receipts.csv").read()))
    print("Total receipts:", len(rcp))
    print("OCR status:", dict(rcp.groupby('ocr_status').size()))
    print("Avg confidence:", round(rcp['confidence_score'].mean(), 3))
    print("High conf (>=0.9):", len(rcp[rcp['confidence_score'] >= 0.9]))

示例

输入
solve()
期望输出
Total receipts: 200
OCR status: {'failed': np.int64(42), 'partial': np.int64(63), 'success': np.int64(95)}
Avg confidence: 0.597
High conf (>=0.9): 14
Python 代码 🔒 登录后使用
🔒

登录后即可练习

注册免费账号,在浏览器中直接运行 Python 代码