def get_activity_data(datasets):
# if not fields:
# fields = ["name", "reference product", "amount", "location", "unit", "database"]
# obj = {}
# for field in fields:
# obj.update({field: key.get(field, '')})
# obj.update({"key": key})
for ds in datasets:
obj = {
'Activity': ds.get('name', ''),
'Reference product': ds.get('reference product', ''), # only in v3
'Location': ds.get('location', 'unknown'),
# 'Amount': "{:.4g}".format(key['amount']),
'Unit': ds.get('unit', 'unknown'),
'Database': ds['database'],
'Uncertain': "True" if ds.get("uncertainty type", 0) > 1 else "False",
'key': ds,
}
yield obj
commontasks.py 文件源码
python
阅读 22
收藏 0
点赞 0
评论 0
评论列表
文章目录