diff options
author | Puneeth Chaganti | 2010-01-21 15:26:11 +0530 |
---|---|---|
committer | Puneeth Chaganti | 2010-01-21 15:26:11 +0530 |
commit | ea8e24ac702226c4d189fcef264b7ed2388268c4 (patch) | |
tree | 4461343a23ac1f37a97c18d1af6bfae52c9c0131 /circulate/sslc_allreg.py | |
parent | 75206fd2f3c988fd74f05a43898666cff9e9682b (diff) | |
download | workshops-more-scipy-ea8e24ac702226c4d189fcef264b7ed2388268c4.tar.gz workshops-more-scipy-ea8e24ac702226c4d189fcef264b7ed2388268c4.tar.bz2 workshops-more-scipy-ea8e24ac702226c4d189fcef264b7ed2388268c4.zip |
Added files to be circulated during workshops.
Diffstat (limited to 'circulate/sslc_allreg.py')
-rw-r--r-- | circulate/sslc_allreg.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/circulate/sslc_allreg.py b/circulate/sslc_allreg.py new file mode 100644 index 0000000..b93405a --- /dev/null +++ b/circulate/sslc_allreg.py @@ -0,0 +1,50 @@ +scores = [[], [], [], [], []] +ninety_percents = [{}, {}, {}, {}, {}] + +for record in open('sslc1.txt'): + record = record.strip() + fields = record.split(';') + + region_code = fields[0].strip() + + for i, field in enumerate(fields[3:8]): + if region_code not in ninety_percents[i]: + ninety_percents[i][region_code] = 0 + score_str = field.strip() + score = 0 if score_str == 'AA' else int(score_str) + scores[i].append(score) + if score > 90: + ninety_percents[i][region_code] += 1 + +subj_total = [] +for subject in ninety_percents: + subj_total.append(sum(subject.values())) + + +figure(1) +pie(ninety_percents[3].values(), labels=ninety_percents[3].keys()) +title('Students scoring 90% and above in science by region') +savefig('science.png') + +figure(2) +pie(subj_total, labels=['English', 'Hindi', 'Maths', 'Science', 'Social']) +title('Students scoring more than 90% by subject(All regions combined).') +savefig('all_regions.png') + +# List method +print "Mean: ", mean(scores[2]) + +print "Median: ", median(scores[2]) + +print "Standard Deviation: ", std(scores[2]) + +# Array method + +#math_scores = array(scores[2]) + +#print "Mean: ", mean(math_scores) + +#print "Median: ", median(math_scores) + +#print "Standard Deviation: ", std(math_scores) + |