source: orange/docs/tutorial/rst/code/data-instances3.py @ 11052:c22077a09e63

Revision 11052:c22077a09e63, 367 bytes checked in by blaz <blaz.zupan@…>, 16 months ago (diff)

new tutorial

Line 
1import Orange
2
3average = lambda xs: sum(xs)/float(len(xs))
4
5data = Orange.data.Table("iris")
6targets = data.domain.class_var.values
7print "%-15s %s" % ("Feature", " ".join("%15s" % c for c in targets))
8for x in data.domain.features:
9    dist = ["%15.2f" % average([d[x] for d in data if d.get_class()==c]) for c in targets]
10    print "%-15s" % x.name, " ".join(dist)
Note: See TracBrowser for help on using the repository browser.