How to read meta properties from RowInstance in Orange?

时间:2018-04-18 18:11:21

标签: python widget orange

I want to display information from RowInstance. The following code snippets display most attributes.

# type(line) is Orange.data.table.RowInstance
for i, cell in enumerate(line.values()):
    print(cell.value)

However, "metadata values" are not accessible from the method values(). Only the feature values are returned.

How can I access metadata from RowInstance?

1 个答案:

答案 0 :(得分:0)

我找到了一种阅读元数据属性的方法

Domain属性包含attributes列表和metadata列表。

>>> line.domain.index("Feature1")
0
>>> line.domain.index("Metadata1")
-1

域还有一个实用程序函数,可以从其名称中获取属性/元索引。这导致发现元数据值位于负索引(-1,-2,-3,...)中。

RowInstance

使用索引,可以获得>>> line[0] Value('Feature1', Hello) >>> line[0].value "Hello" >>> line[-2].value 4.0 (行变量)的值。

Om

参考:https://docs.orange.biolab.si/3/data-mining-library/reference/data.domain.html