How good are Philly Charter Schools? (Data analysis with Python)

Let’s look at the average SAT scores from 2001-2010 for all philly charter schools and see how they did. Do do this analysis with Python, first you need to download the excel file from here:

After you download that, open it up and convert it to a CSV file (file>save as>.csv)
Nice. Now we can manipulate it using python. Before you fire up your editor of choice though, take a look at the column headings and the information present in the CSV file. Ok we are good to go.

Rename your file to something simple. (I named it SAT_SCORES_2001_2010.csv)

Then import the csv module.

import csv
f=open('SAT_SCORES_2001_2012.csv') #open the file

school=[]#list to hold all the schools  charterSchools=[] #list to hold only charter schools
scores=[] #list to hold the average scores

for row in csv.DictReader(f):#get the school name and scores
    school=row['SCHOOL NAME']
     if math!="*" and writing!="*" and verbal!="*":#ignore N/A values
       total_score=int(math)+int(writing)+int(verbal) #add all the values
       schools.append(school) #store the values
       scores.append(total_score) #store the scores

for name in schools: 
   if "CHARTER" in name:
      tempScore=scores[schools.index(name)] #get the score of the respective school
      charter_scores.append(tempScore)#put them in the charter_scores List
      charterSchools.append(name)#put the school name in the list
      print name,temp #print the name and the score out

What you will get from the above code is a list of all the Charter Schools in Philadelphia and their respective average SAT scores.

And geez they are pretty bad. After looking at this data, I’m kinda suspicious about private schools.


Tell me what you think!

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s