Photo by Jannis Lucas on Unsplash.
Every year, American high school students take SATs, which are standardized tests intended to measure literacy, numeracy, and writing skills. There are three sections - reading, math, and writing, each with a maximum score of 800 points. These tests are extremely important for students and colleges, as they play a pivotal role in the admissions process.
Analyzing the performance of schools is important for a variety of stakeholders, including policy and education professionals, researchers, government, and even parents considering which school their children should attend.
You have been provided with a dataset called schools.csv, which is previewed below.
You have been tasked with answering three key questions about New York City (NYC) public school SAT performance.
# Re-run this cell
import pandas as pd
# Read in the data
schools = pd.read_csv("schools.csv")
schools.sort_values('school_name', ascending = False)
schools.head()
# Start coding here...
# Add as many cells as you like...schools.sort_values('average_math', ascending = False)
print(schools.head(10))best_math_schools = schools.sort_values('average_math',ascending = False)
best_math_schools = best_math_schools[['school_name','average_math']]
best_math_schools = best_math_schools[best_math_schools['average_math'] >= 640]
print(best_math_schools)
combined_scores = schools
combined_scores['total_SAT'] = combined_scores['average_math'] + combined_scores['average_reading'] + combined_scores['average_writing']
combined_scores = combined_scores.sort_values('total_SAT', ascending = False)
top_10_schools = combined_scores[['school_name','total_SAT']]
top_10_schools = top_10_schools.head(10)
print(top_10_schools)largest_std_dev = schools
largest_std_dev = pd.merge(combined_scores, largest_std_dev, on = 'school_name', how = 'left', suffixes = ("", "_top"))
print(largest_std_dev.head(10))
print(pd.DataFrame(largest_std_dev.columns, columns = ['Column Names']))largest_std_dev = largest_std_dev.groupby('borough').agg(
num_schools = ('school_name', 'count'),
average_SAT = ('total_SAT', 'mean'),
std_SAT = ('total_SAT', 'std')
)
for column in largest_std_dev.columns:
if pd.api.types.is_numeric_dtype(largest_std_dev[column]):
largest_std_dev[column] = largest_std_dev[column].round(2)
largest_std_dev = largest_std_dev.sort_values('std_SAT', ascending = False)
largest_std_dev = largest_std_dev.head(1)
print(largest_std_dev)