← 返回题库
中级

实现土壤数据按小时聚合

未完成
中级参考 代码结构已给出,请填写 ____ 处
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(____))
    soil = readings[readings['____'].isin(____)]
    soil = soil.copy()
    soil['____'] = (____).astype(____) * ____
    agg = soil.groupby(____)['____'].agg(____).reset_index()
    agg.columns = ['____','____','____','____','____','____','____']
    print(____)
    for _, row in agg.head(____).iterrows():
        print("____"+row['____']+"____"+row['____']+"____"+str(int(____))+"____"+str(round(____))+"____"+str(round(____))+"____"+str(round(____))+"____"+str(int(____)))

示例

输入
solve()
期望输出
Hourly soil aggregations:
  SOIL-A01/soil_ec h=1748736000: min=2.46 max=2.46 avg=2.46 n=1
  SOIL-A01/soil_ec h=1748739600: min=2.36 max=2.36 avg=2.36 n=1
  SOIL-A01/soil_ec h=1748743200: min=2.46 max=2.46 avg=2.46 n=1
  SOIL-A01/soil_ec h=1748746800: min=2.12 max=2.12 avg=2.12 n=1
  SOIL-A01/soil_ec h=1748750400: min=2.39 max=2.39 avg=2.39 n=1
  SOIL-A01/soil_ec h=1748754000: min=2.36 max=2.36 avg=2.36 n=1
  SOIL-A01/soil_ec h=1748757600: min=2.07 max=2.07 avg=2.07 n=1
  SOIL-A01/soil_ec h=1748761200: min=2.45 max=2.45 avg=2.45 n=1
  SOIL-A01/soil_ec h=1748764800: min=2.44 max=2.44 avg=2.44 n=1
Python 代码 🔒 登录后使用
🔒

登录后即可练习

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