【发布时间】:2020-05-10 23:01:15
【问题描述】:
我有这样的 csv:
id,company_name,country,country_id
1,batstop,usa, xx
2,biorice,italy, yy
1,batstop,italy, yy
3,legstart,canada, zz
我想要将一组字典导入到 firebase。我需要将同一公司的不同国家信息分组到嵌套的字典列表中。这是所需的输出:
[ {'id':'1', 'agency_name':'batstop', countries [{'country':'usa','country_id':'xx'}, {'country':'italy','country_id':'yy'}]} ,
{'id':'2', 'agency_name':'biorice', countries [{'country':'italy','country_id':'yy'}]},
{'id':'3', 'legstart':'legstart', countries [{'country':'canada','country_id':'zz'}]} ]
【问题讨论】:
标签: python arrays firebase csv dictionary