中级
构建设备资产树形JSON输出
未完成
中级参考
代码结构已给出,请填写 ____ 处
def solve():
from pyodide.http import open_url
from io import StringIO
import pandas as pd
bld_csv = open_url(____).read()
loc_csv = open_url(____).read()
scr_csv = open_url(____).read()
buildings = pd.read_csv(StringIO(____))
locations = pd.read_csv(StringIO(____))
screens = pd.read_csv(StringIO(____))
tree = {}
for region, rblds in buildings.groupby(____):
tree[region] = {'____':len(____),'____':____}
for _, bld in rblds.iterrows():
locs = locations[locations['____']==bld['____']]
for _, loc in locs.iterrows():
scr_count = len(____)
tree[region]['____'] += scr_count
print(____)
for region, data in tree.items():
print("____"+str(____)+"____"+str(____)+"____"+str(____)+"____")
示例
输入
solve()
期望输出
Asset tree summary: 天河: 10 buildings 36 screens 朝阳: 10 buildings 36 screens 江汉: 10 buildings 36 screens 浦东: 10 buildings 36 screens 海淀: 10 buildings 36 screens
👑
升级 VIP
解锁全部题目,畅通无阻地学习
- ✓ 解锁全部训练包所有题目
- ✓ 查看完整参考代码和提示
- ✓ 浏览器内直接运行 Python 代码
- ✓ 自动批改 + 进度追踪
30天
¥18
1年
¥99
2年
¥158
3年
¥199