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")
# Preview the data
schools.head()
# Start coding here...
# Add as many cells as you like...
best_math_schools_temp = schools.sort_values(by=["average_math", "school_name"], ascending=False)
best_math_schools_temp = best_math_schools_temp.reset_index()
best_math_schools_temp.head()
best_math_schools_temp = best_math_schools.iloc[0:10,:]
best_math_schools = best_math_schools_temp.loc[:, ["average_math", "school_name"]]
best_math_schools.head(20)
top_10_schools_temp = schools
top_10_schools_temp["total_SAT"] = top_10_schools_temp["average_math"] + top_10_schools_temp["average_reading"] + top_10_schools_temp["average_writing"]
top_10_schools_temp = top_10_schools_temp.sort_values(by=["total_SAT"], ascending=False)
top_10_schools = top_10_schools_temp.iloc[:10,:]
top_10_schools = top_10_schools[["school_name","total_SAT"]]
top_10_schools.head(20)
borough = top_10_schools_temp.groupby(["borough"]).count()
borough = borough.reset_index()
mean_totalSAT = top_10_schools_temp.groupby(["borough"])["total_SAT"].mean()
std_totalSAT = top_10_schools_temp.groupby(["borough"])["total_SAT"].std()
std_totalSAT = pd.DataFrame(std_totalSAT)
std_totalSAT = std_totalSAT.reset_index()
nameLargest_totalSAT = std_totalSAT["total_SAT"].max()
nameLargest_totalSAT = std_totalSAT[std_totalSAT["total_SAT"] == 230.2941395363781]
nameLargest_totalSAT = nameLargest_totalSAT.iloc[0]["borough"]
largest_std_dev = pd.DataFrame({
"borough" : nameLargest_totalSAT,
"num_schools" : borough.loc[borough["borough"] == nameLargest_totalSAT, "school_name"],
"average_SAT" : mean_totalSAT[nameLargest_totalSAT],
"std_SAT" : std_totalSAT.loc[std_totalSAT["borough"] == nameLargest_totalSAT]["total_SAT"]
})
largest_std_dev = largest_std_dev.round(2)
largest_std_dev.head()