circulate/sslc_allreg.py
author Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
Mon, 21 Jun 2010 00:49:03 -0400
branchscipy2010
changeset 412 ca04d463c573
parent 385 c70118cdde66
permissions -rwxr-xr-x
ENH: Enhanced the problem set building on the image handing and arrays. Illustrated dtypes, casting and their importance along with an example using RGBA images. Also introduce edge detection.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
358
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     1
385
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
     2
math_scores = []
358
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     3
for record in open('sslc1.txt'):
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     4
    fields = record.split(';')
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     5
385
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
     6
    math_score = fields[5].strip()
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
     7
    if math_score != 'AA':
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
     8
        math_scores.append(int(math_score))
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
     9
    else:
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
    10
        math_scores.append(0)
358
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    11
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    12
385
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
    13
# List method
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
    14
print "Mean: ", mean(math_scores)
358
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    15
385
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
    16
print "Median: ", median(math_scores)
358
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    17
385
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
    18
print "Standard Deviation: ", std(math_scores)
358
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    19
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    20
# Array method
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    21
385
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
    22
math_scores = array(math_scores)
358
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    23
385
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
    24
print "Mean: ", mean(math_scores)
358
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    25
385
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
    26
print "Median: ", median(math_scores)
358
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    27
385
c70118cdde66 Minor corrections.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 359
diff changeset
    28
print "Standard Deviation: ", std(math_scores)
358
162e3e453920 Added files to be circulated during workshops.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    29