-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstudent_performance.py
More file actions
166 lines (127 loc) · 6.36 KB
/
Copy pathstudent_performance.py
File metadata and controls
166 lines (127 loc) · 6.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# %% [markdown]
# # Project 04: Student Performance Analysis
# ## Business Scenario
#
# Aim: Understand student performance problems, hired by a school administrator
#
# Objectives: The school want to understand:
# 1. Which student perform best?
# 2. Does attendance affect performance?
# 3. which student improve the most?
# 4. Which student needs intervention?
# 5. Should the school focus on improving attendance?
# %% [markdown]
# ## STEP 01: Import
# %%
#Import
import pandas as pd
import matplotlib.pyplot as plt
# %% [markdown]
# ## STEP 02: Load the dataset
# %%
df = pd.read_csv("student_performance.csv")
df
# %% [markdown]
# ## STEP 03: Understand the dataset
# %%
df.head()
df.info()
df.describe()
# %% [markdown]
# The dataset 10 rows and 4 columns with each rows describing academic details for a particular student, each columns(Student, Year, Attendance, Score) giving unit record of total details for each student. There are 3 columns with integer datatype (Year, Attendance, Score) and 1 columns with string datatype (Student).
# %% [markdown]
# ## STEP 04: Exploratory Data Analysis (EDA)
# %% [markdown]
# ### First Analysis: Student Performance - Who has the highest average score?
# Questions
# 1. Best performing student?
# 2. Lowest performing student?
# %%
df.groupby("Student")["Score"].mean().sort_values(ascending=False)
# %% [markdown]
# Answers:
#
# 1. Sarah is the best performing student having the highest average score of 93.5
# 2. David is the student with the lowest performance with an average score of 58.5
# %% [markdown]
# ### Second Analysis: Improvement Tracing - Which student improve the most from 2023 - 2024
# Questions
# 1. Most improved student?
# 2. Least improved student?
# %%
# create a pivot table - like creating a new DataFrame to focus on from a very much larger DataFrame
improvement = df.pivot(
index="Student",
columns="Year",
values="Score"
)
#get the actual score improvement by subtracting the later year(2024) from the previous year(2023) and store in a new column Score_Improvement of the Improvement mini DataFrame
improvement["Score_Improvement"] =(improvement[2024] - improvement[2023])
#sort the Improvement mini dataframe with the Score_Improvement column
improvement.sort_values("Score_Improvement",ascending=False)
# %% [markdown]
# Answers:
#
# 1. Mary is the most improved student having a total of 18 more score than previous year (2023)
# 2. Sarah score improvement is the lowest at just 3 score difference from previous year.
# %% [markdown]
# ### Third Analysis: Attendance vs Performance - Do attendance affect score
# 1. Positive or negative correlation?
# 2. weak, moderate or strong relationship?
# 3. What does this imply?
# %%
df[["Attendance", "Score"]].corr()
# %% [markdown]
# Answers:
#
# 1. There is positive relationship Between Attendance and Score
# 2. The relationship is strong of 0.9
# 3. The strong positive relationship suggest that attendance is very important in improving Score i.e.higher attendance is strongly associated with higher scores.
# %% [markdown]
# ## STEP 05: Visualization
# %% [markdown]
# ### Student Average Score
# %%
df.groupby("Student")["Score"]\
.mean()\
.sort_values()\
.plot(kind="barh")
plt.title("Average Student Score")
plt.show()
# %% [markdown]
# ### Score Improvement by Year
# %%
improvement.sort_values("Score_Improvement",ascending=False).plot(kind="bar")
plt.title("Score Improvement by Year")
plt.xlabel("Student")
plt.ylabel("")
plt.show()
# %% [markdown]
# ### Attendance vs Score
# %%
plt.scatter(
df["Attendance"],
df["Score"]
)
plt.xlabel("Attendance")
plt.ylabel("Score")
plt.title("Attendance vs Score")
plt.show()
# %% [markdown]
# ## STEP 06: Key Insights
# 1. Sarah has the highest average score. This suggests consistent high performance which one of the factors is having the highest attendance, this is backed from the correlation analysis.
# 2. David has the lowest average score making him the least performing student. One of the factors that can be attributed to this is having the lowest attendance score over the years which really means a lot.
# 3. Mary is the most improved student having the second best average score and the highest improvement score. Her data suggests continuous improvement in both assessment and attendance. A relentless pursuer of success.
# 4. Sarah is the least improved student over the years. the suggests that she maintain her position as the top student with now little or no breakthrough in improving her score.
# 5. Attendance trend and correlation clarify that student with high attendance score usually have higher performance, this can be observed in Sarah and Mary
# 6. David needs the most support as is performance is the least among all student, followed by John and Michael that both have average performance.There improvement score shows that they all have the potential to do more better. first line of focus should be on their attendance score, then other factors can be investigated.
# 7. Sarah as the top student also need support as there is no significant improvement over the years.
# %% [markdown]
# ## Executive Recommendations
# %% [markdown]
# Based on the Analysis done within the limit of available dataset, i would like to make the following recommendation:
# 1. The school first line of action should be on improving the student attendance score as this is very important in improving their performance, investigation should be made on the causes of low or average attendance score and solution should be made.
# 2. the reading habit of the best performing student Sarah and the unrelenting Mary should be investigated to know what factors contribute to their high score and continuous improvement although much can be seen in their attendance score.
# 3. Provision should be made in supporting the average performing student like John and Michael as their improvement score suggest high potential for more brilliant performance.
# 4. Reward system should be established to compliment student with high performance to ensure continuous race towards high performance. This particular aspect is especially more concerned about student Sarah who shows little improvement over the years despite her attendance score which may be due to already performing near the top of the scoring range.
# 5. Sensitization Programs should be made to educate student on the importance of high performance and implication of being absent from lessons.