summaryrefslogtreecommitdiff
path: root/circulate/sslc_allreg.py
diff options
context:
space:
mode:
authorSantosh G. Vattam2010-04-23 08:49:25 +0530
committerSantosh G. Vattam2010-04-23 08:49:25 +0530
commite17f34beba1df09250d2e80d502e291aa97be3ac (patch)
tree1bc8875aa33e61669ef64d1dfc5b7a99080fc625 /circulate/sslc_allreg.py
parenta46479c09eba9fe9b56745961ae3a228f7cd4188 (diff)
downloadworkshops-e17f34beba1df09250d2e80d502e291aa97be3ac.tar.gz
workshops-e17f34beba1df09250d2e80d502e291aa97be3ac.tar.bz2
workshops-e17f34beba1df09250d2e80d502e291aa97be3ac.zip
Minor corrections.
Diffstat (limited to 'circulate/sslc_allreg.py')
-rwxr-xr-x[-rw-r--r--]circulate/sslc_allreg.py47
1 files changed, 13 insertions, 34 deletions
diff --git a/circulate/sslc_allreg.py b/circulate/sslc_allreg.py
index 16dc12f..110a924 100644..100755
--- a/circulate/sslc_allreg.py
+++ b/circulate/sslc_allreg.py
@@ -1,50 +1,29 @@
-scores = [[], [], [], [], []]
-ninety_percents = [{}, {}, {}, {}, {}]
+math_scores = []
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
+ math_score = fields[5].strip()
+ if math_score != 'AA':
+ math_scores.append(int(math_score))
+ else:
+ math_scores.append(0)
-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 "Mean: ", mean(math_scores)
-print "Median: ", median(scores[2])
+print "Median: ", median(math_scores)
-print "Standard Deviation: ", std(scores[2])
+print "Standard Deviation: ", std(math_scores)
# Array method
-#math_scores = array(scores[2])
+math_scores = array(math_scores)
-#print "Mean: ", mean(math_scores)
+print "Mean: ", mean(math_scores)
-#print "Median: ", median(math_scores)
+print "Median: ", median(math_scores)
-#print "Standard Deviation: ", std(math_scores)
+print "Standard Deviation: ", std(math_scores)