filters.py
来自「orange源码 数据挖掘技术」· Python 代码 · 共 32 行
PY
32 行
import orange
############ THIS IS WHAT YOU CAN DO WITH DISCRETE ATTRIBUTES
data = orange.ExampleTable("lenses")
data[0][0] = "?"
data[1][0] = "?"
data[1][1] = "?"
fspec = orange.Filter_isDefined(domain=data.domain)
print "\nCheck all attributes"
print [fspec(ex) for ex in data]
print "\nCheck all attributes (but with 'check' given)"
fspec.check = [1] * len(data.domain)
print [fspec(ex) for ex in data]
print "\nIgnore the first attribute"
fspec.check[0] = 0
print [fspec(ex) for ex in data]
print "\nIgnore the first attribute, check the second (and ignore the rest, list is too short)"
fspec.check = [0, 1]
data[0][3] = "?"
print [fspec(ex) for ex in data]
print "\nAdd the 'age' to the list of the checked"
fspec.check["age"] = 1
print [fspec(ex) for ex in data]
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?