Python Program to process student's Result data

This program reads student's result file and display normalization curve. Sample of student's result file is given below. Copy the data in text editor and save it as comma separated variable (.csv) file and save it in the same folder where the python program is saved.

File Name: grade.csv 

Roll_Number,Sub1,Sub2,Sub3,Sub4,Sub5

1,12,14,13,10,12

2,11,10,11,8,11

3,17,10,8,11,13

4,13,8,5,11,8

5,16,11,10,7,7

6,19,20,16,18,18

7,12,11,5,8,9

8,13,9,8,8,6

9,10,6,5,9,6

10,10,18,8,10,5

11,10,9,6,6,8

12,15,4,6,1,4

13,10,5,8,4,8

14,0,0,0,0,0

15,11,12,9,8,10

16,14,4,8,9,8

17,14,12,5,9,10

18,19,12,13,14,9

19,9,10,1,5,5

20,8,5,4,6,5

21,15,12,9,8,10

22,7,8,2,3,8

23,10,11,13,10,12

24,7,13,5,10,8

25,9,12,2,13,9

26,3,5,1,3,8

27,12,4,10,11,9

28,12,4,9,11,9

29,7,15,1,6,9

30,14,12,15,8,8

31,11,11,11,11,13

32,11,13,8,10,12

33,5,7,0,5,5

34,0,5,6,4,6

35,5,10,4,8,5

36,10,10,5,8,9

37,3,10,3,8,5

38,6,8,2,6,5

39,9,8,8,7,4

40,6,8,4,11,5

41,10,10,1,8,4

42,16,18,11,16,12

Python Program

#Program to read student's result file and display normalization curve

import pandas

import matplotlib.pyplot as plt

from scipy.stats import norm

import statistics as st

import numpy as np

#object of the data file

df = pandas.read_csv("grade.csv")

df.describe()

rn = df['Roll_Number']

sub1 = df['Sub1']

sub2 = df['Sub2']

sub3 = df['Sub3']

sub4 = df['Sub4']

sub5 = df['Sub5']

# Calculating mean and standard deviation

mean3 = st.mean(sub3)

sd3 = st.stdev(sub3)

mean4 = st.mean(sub4)

sd4 = st.stdev(sub4)

#print(mean1,sd1)

# Set general plot dimensions

plt.rcParams["figure.figsize"] = (20,15)

plt.xlim([0,20])

x_sub4 = np.arange(0,21,0.5)

y_sub4 = norm.pdf(sub4, mean4, sd4)

y_sub3=norm.pdf(sub3,mean3,sd3)

print(x_sub4)

print(y_sub4)

# Build three subplots

plt.subplot(1,2 , 1)

plt.scatter(sub4, y_sub4, label = 'CAD/CAM IA-1 Marks', color = "black")

s2 = plt.hist(df['Sub4'], 18, density = True, color = "black")

plt.title("CAD/CAM IA-1 Marks")

plt.subplot(1, 2, 2)

plt.scatter(sub3, y_sub3, label = 'fitted curve', color = "orange")

s3 = plt.hist(df['Sub3'], 18, density = True, color = "cyan")

plt.title("KOM IA-1 Marks")

# Set the global title

plt.suptitle("Normality check of students scores using histograms")

#plt.hist(sub1,norm.pdf(sub1, mean, sd))

plt.show()