1. 程式人生 > >模擬城市_資料分析(草稿)

模擬城市_資料分析(草稿)


rooms={'instrum':{'hamer':{'price':1,'time':1,'compon':['Fe']}},
'materl':{'nail':{'price':1,'time':1...}}
'elem':{'Fe':{},'wood':{},'C':{},'melon':{}}
'food':{'vegatable':}}

df=pd.dataFrame()
for room in rooms:
for tools in room:
time,price,add=[],[],[]
for tool in tools:
time.append(tool['time'])
price.append(tool['price'])
add.append(tool['price']-np.sum([i['price'] for i in tool['compon']]))

df['time']=time
df['price']=price
df['addition'] = add