← 返回题库
中级

实现播放完整性验证

未完成
中级参考 代码结构已给出,请填写 ____ 处
def solve():
    from pyodide.http import open_url
    from io import StringIO
    import pandas as pd
    pl_csv = open_url(____).read()
    sch_csv = open_url(____).read()
    logs = pd.read_csv(StringIO(____))
    schedules = pd.read_csv(StringIO(____))
    MIN_COMPLETE_RATIO = ____
    def validate_completeness(____):
        sch = schedules_df[schedules_df['____']==log_row['____']]
        if sch.empty: return '____', None
        planned = int(____)
        actual = int(____)
        ratio = actual / planned if planned > ____ else ____
        if ratio >= MIN_COMPLETE_RATIO: return '____', ratio
        return '____', ratio
    results = {'____':____,'____':____,'____':____}
    invalid_examples = []
    for _, row in logs.head(____).iterrows():
        status, ratio = validate_completeness(____)
        results[status] += ____
        if status == '____' and ratio is not None:
            invalid_examples.append({'____':row['____'],'____':round(____)})
    print(____)
    print("____"+str(____)+"____"+str(____)+"____"+str(____))
    for ex in invalid_examples[:____]:
        print("____"+ex['____']+"____"+str(____))

示例

输入
solve()
期望输出
Completeness validation (first 50 logs):
  valid=40 invalid=10 unknown=0
  INVALID PL-0000009 ratio=0.6
  INVALID PL-0000021 ratio=0.6
  INVALID PL-0000025 ratio=0.4
Python 代码 🔒 登录后使用
🔒

登录后即可练习

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