source: orange/docs/tutorial/rst/code/report_missing.py @ 9747:9abf63b01601

Revision 9747:9abf63b01601, 618 bytes checked in by Miha Stajdohar <miha.stajdohar@…>, 2 years ago (diff)

Changed data set path.

Line 
1# Description: Read data and for each attribute report percent of instances with missing value
2# Category:    description
3# Uses:        adult_sample.tab
4# Referenced:  basic_exploration.htm
5
6import orange
7data = orange.ExampleTable("adult_sample.tab")
8
9natt = len(data.domain.attributes)
10missing = [0.] * natt
11for i in data:
12    for j in range(natt):
13        if i[j].isSpecial():
14            missing[j] += 1
15missing = map(lambda x, l=len(data):x / l * 100., missing)
16
17print "Missing values per attribute:"
18atts = data.domain.attributes
19for i in range(natt):
20    print %5.1f%s %s" % (missing[i], '%', atts[i].name)
Note: See TracBrowser for help on using the repository browser.