运行 wurst library with brightway 时出现键盘错误
keyerror when running wurst library with brightway
我正在测试 Brightway 的 wurst 库,但我遇到了一些具有多个功能的键盘错误。
例如,如果我 运行 :
import wurst as w
#act is a random activity from ecoinvent database
w.transformations.geo.copy_to_new_location(act,'CA-QC')
我收到一条关键错误消息。 按键错误:'exchanges'。
我在使用更简单的函数时遇到了同样的错误,例如 参考产品。查看代码,我发现它调用了 act['exchanges'] ,它在我的数据库中没有定义为键。如果我 运行:
act.as_dict().keys()
我得到 dict_keys(['comment', 'classifications', 'activity type', 'activity', 'database', 'filename', 'location', 'name', 'parameters', 'authors', 'type', 'reference product', 'flow', 'unit', 'production amount', 'code'])
。但不是 'exchanges'
。
我使用的是 Brightway 2.1.1 版和 wurst 0.1。怎么了?
Wurst 和 Brightway 是不同的生态系统 - 它们可以相互交流,但应该分开。在 Wurst 中,您需要从数据源加载数据——Brightway 就是其中之一——然后对其进行操作。传入 Brightway 对象将不起作用,因为数据格式完全不同。见Wurst examples and the Wurst documentation.
中的介绍
我正在测试 Brightway 的 wurst 库,但我遇到了一些具有多个功能的键盘错误。
例如,如果我 运行 :
import wurst as w
#act is a random activity from ecoinvent database
w.transformations.geo.copy_to_new_location(act,'CA-QC')
我收到一条关键错误消息。 按键错误:'exchanges'。
我在使用更简单的函数时遇到了同样的错误,例如 参考产品。查看代码,我发现它调用了 act['exchanges'] ,它在我的数据库中没有定义为键。如果我 运行:
act.as_dict().keys()
我得到 dict_keys(['comment', 'classifications', 'activity type', 'activity', 'database', 'filename', 'location', 'name', 'parameters', 'authors', 'type', 'reference product', 'flow', 'unit', 'production amount', 'code'])
。但不是 'exchanges'
。
我使用的是 Brightway 2.1.1 版和 wurst 0.1。怎么了?
Wurst 和 Brightway 是不同的生态系统 - 它们可以相互交流,但应该分开。在 Wurst 中,您需要从数据源加载数据——Brightway 就是其中之一——然后对其进行操作。传入 Brightway 对象将不起作用,因为数据格式完全不同。见Wurst examples and the Wurst documentation.
中的介绍