source: orange/docs/reference/rst/code/transformvalue-miv.py @ 9924:69d0ac45ad93

Revision 9924:69d0ac45ad93, 479 bytes checked in by janezd <janez.demsar@…>, 2 years ago (diff)

Added documentation on TransformValue

Line 
1import Orange
2
3data = Orange.data.Table("lenses")
4age = data.domain["age"]
5
6age_b = Orange.feature.Discrete("age_c", values = ['young', 'old'])
7age_b.getValueFrom = Orange.core.ClassifierFromVar(whichVar = age)
8age_b.getValueFrom.transformer = Orange.core.MapIntValue()
9age_b.getValueFrom.transformer.mapping = [0, 1, 1]
10
11newDomain = Orange.data.Domain([age_b, age], data.domain.classVar)
12newData = Orange.data.Table(newDomain, data)
13for ex in newData:
14    print ex
15print "\n\n"
Note: See TracBrowser for help on using the repository browser.