source: orange/docs/reference/rst/code/instance_merge.py @ 9936:08300d990d26

Revision 9936:08300d990d26, 750 bytes checked in by markotoplak, 2 years ago (diff)

moved new_meta_ide from feature to feature.Descriptor

Line 
1# xtest: RANDOM
2
3import Orange
4
5data1 = Orange.data.Table("merge1")
6data2 = Orange.data.Table("merge2")
7
8a1, a2 = data1.domain.attributes
9
10metas = data1.domain.getmetas()
11m1, m2 = data1.domain["m1"], data1.domain["m2"]
12m1i, m2i = data1.domain.metaid(m1), data1.domain.metaid(m2)
13
14a1, a3 = data2.domain.attributes
15n1 = Orange.feature.Continuous("n1")
16n2 = Orange.feature.Continuous("n2")
17
18new_domain = Orange.data.Domain([a1, a3, m1, n1])
19new_domain.addmeta(m2i, m2)
20new_domain.addmeta(Orange.feature.Descriptor.new_meta_id(), a2)
21new_domain.addmeta(Orange.feature.Descriptor.new_meta_id(), n2)
22
23merge = Orange.data.Instance(new_domain, [data1[0], data2[0]])
24print "First example: ", data1[0]
25print "Second example: ", data2[0]
26print "Merge: ", merge
Note: See TracBrowser for help on using the repository browser.