中级
实现素材连续失败告警
未完成
中级参考
代码结构已给出,请填写 ____ 处
def solve():
from pyodide.http import open_url
from io import StringIO
import pandas as pd
err_csv = open_url(____).read()
errors = pd.read_csv(StringIO(____))
CONSEC_FAIL_THRESHOLD = ____
def check_creative_failures(____):
crv_errs = errors_df[errors_df['____']==creative_id].sort_values(____)
if len(____) < CONSEC_FAIL_THRESHOLD: return False, len(____)
rows = list(____)
consec = ____; max_consec = ____
for r in rows:
consec = ____ if int(____) else consec + ____
max_consec = max(____)
return max_consec >= CONSEC_FAIL_THRESHOLD, max_consec
print("____"+str(____)+"____")
alert_creatives = []
for crv_id in errors['____'].unique():
is_alert, max_c = check_creative_failures(____)
if is_alert:
alert_creatives.append(____)
for a in alert_creatives[:____]:
print("____"+a['____']+"____"+str(____))
print("____"+str(len(____)))
示例
输入
solve()
期望输出
Creative failure alerts (threshold=3 consecutive): Total creative alerts: 0
👑
升级 VIP
解锁全部题目,畅通无阻地学习
- ✓ 解锁全部训练包所有题目
- ✓ 查看完整参考代码和提示
- ✓ 浏览器内直接运行 Python 代码
- ✓ 自动批改 + 进度追踪
30天
¥18
1年
¥99
2年
¥158
3年
¥199