← 返回题库
中级

检测EC/pH传感器读数卡死

未完成
中级参考 代码结构已给出,请填写 ____ 处
def solve():
    from pyodide.http import open_url
    from io import StringIO
    import pandas as pd
    st_csv = open_url(____).read()
    st = pd.read_csv(StringIO(____))
    stuck_thresholds = {r['____']:int(____) for _,r in st.iterrows()}
    readings_data = {
        (____): [____]*____,
        (____): [____,____,____,____,____,____,____,____,____,____],
        (____): [____,____,____,____,____,____,____,____,____,____],
    }
    def detect_stuck(____):
        if len(____) < threshold: return False
        last_n = values[-threshold:]
        return len(set(____)) == ____
    print(____)
    for (____), vals in readings_data.items():
        threshold = stuck_thresholds.get(____)
        stuck = detect_stuck(____)
        print("____" + did + "____" + metric + "____" + str(____) + "____" + str(____) + "____")

示例

输入
solve()
期望输出
Stuck value detection:
  SOIL-A02/soil_ec: stuck=True (threshold=8)
  SOIL-A01/soil_ph: stuck=False (threshold=8)
  SOIL-B01/soil_moisture: stuck=False (threshold=8)
Python 代码 🔒 登录后使用
🔒

登录后即可练习

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