中级
实现时序数据TTL过期清理
未完成
中级参考
代码结构已给出,请填写 ____ 处
def solve():
from pyodide.http import open_url
from io import StringIO
import pandas as pd
readings_csv = open_url(____).read()
readings = pd.read_csv(StringIO(____))
RAW_TTL = ____ * ____
AGG_TTL = ____ * ____
now = readings['____'].max() + ____
def check_ttl(____):
ttl = RAW_TTL if data_type=='____' else AGG_TTL
age = now - uploaded_at
if age > ttl: return '____', age
return '____', age
expired = ____; alive = ____
for _, row in readings.iterrows():
status, age = check_ttl(____)
if status == '____': expired += ____
else: alive += ____
print(____)
print("____" + str(round(____)))
print("____" + str(____) + "____")
print("____" + str(____) + "____")
print("____" + str(____) + "____")
示例
输入
solve()
期望输出
TTL cleanup simulation: Now: 1748937600 Raw data TTL: 7 days Alive: 528 records Expired: 0 records
👑
升级 VIP
解锁全部题目,畅通无阻地学习
- ✓ 解锁全部训练包所有题目
- ✓ 查看完整参考代码和提示
- ✓ 浏览器内直接运行 Python 代码
- ✓ 自动批改 + 进度追踪
30天
¥18
1年
¥99
2年
¥158
3年
¥199