Skip to content
ANALYSIS OF EXAM SCORES OF STUDENTS
'''DATA IMPORTATION'''
#importing packages
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt#importing files
exam_scores=pd.read_csv('data/exams.csv')
exam_scores.head()
'''DATA CLEANING'''
#let's look at the info of the data
exam_scores.info()From the information above, there are 1000 entries with 8 columns. Also, there are no null values.
'''further cleaning'''
#checking unique gender
exam_scores['gender'].unique()The unique values are male and female
#checking unique values of lunch
exam_scores['lunch'].unique()'''DATA WRANGLING'''
# we would get the average reading scores for students with test preparation course
students_test=exam_scores['test_prep_course']=='completed'
exam_scores_test=exam_scores[students_test]
exam_scores_test.head(10)
exam_scores_test['reading'].mean()The average reading score for student's that completed the test preparation course is about 74.
# we would get the average reading scores for students without test preparation course
students_notest=exam_scores['test_prep_course']=='none'
exam_scores_notest=exam_scores[students_notest]
exam_scores_notest['reading'].mean()The average reading score for student's that did not complete the test preparation course is about 66
#we would get the average scores for the different parental education level
parental_scores=exam_scores.groupby('parent_education_level')[['math','reading','writing']].mean()
parental_scores.sort_values(by=['math','reading','writing']).head(10)
We can see that children whose parent's had a master's degree educational level had a average score of about 76 in writing while children whose parent's educational level had an average of 62 in maths.
'''DATA VISUALIZATION'''
#plot of average reading score for student's with test preparation and without
g=sns.barplot(x=exam_scores['test_prep_course'],y=exam_scores['reading'])
plt.show()#plot of average reading scores for different parent educational levels
sns.barplot(x=exam_scores['parent_education_level'],y=exam_scores['reading'])
plt.title('Average reading scores for various parent educational level')
plt.xticks(rotation=90)
plt.show()