Skip to content
Programs · Program 4-14
Q.

(Program 4-14) In order to assess the performance of students of a class in the annual examination, the class teacher stored marks of the students in all the 5 subjects in a CSV "Marks.csv" file as shown in Table 4.8. Plot the data using boxplot and perform a comparative analysis of performance in each subject.

Table 4.8 -- marks obtained by students in five subjects:

NameEnglishMathsHindiScienceSocial_Studies
Rishika Batra9595909495
Waseem Ali9576797789
Kulpreet Singh7881757688
Annie Mathews8863677780
Shiksha9555515980
Naveen Gupta8255635674
Taleem Ahmed7349546077
Pragati Nigam8050515476
Usman Abbas9243514869
Gurpreet Kaur6043555271
Sameer Murthy6043555271
Angelina7833394868
Angad Bedi6243514854
Yanam BieapTextbookSubjective· 4mImportance★★★★★est
39% · 17/44 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

One call plots box plots for every subject column in Marks.csv.

import pandas as pd
import matplotlib.pyplot as plt
data= pd.read_csv('Marks.csv')
df= pd.DataFrame(data)
df.plot(kind='box')
plt.title('Performance Analysis')
plt.xlabel('Subjects')
plt.ylabel('Marks')
plt.show()

df.plot(kind='box') box-plots every numeric column of the DataFrame directly -- no need to manually extract each subject's marks into separate arrays first.

Step by step

  1. pd.read_csv('Marks.csv') loads Table 4.8's six numeric mark columns (English, Maths, Hindi, Science, Social_Studies) plus the non-numeric Name column.
  2. df.plot(kind='box') box-plots every NUMERIC column in one call; Name is skipped the same way it would be for a histogram, since a box plot needs a numeric distribution per box.
  3. Each box shows that subject's quartiles: the box spans the middle 50% of marks, the line inside is the median, and the whiskers reach out to the typical range; a lone circle beyond a whisker marks an outlier.

Reading Table 4.8's actual numbers against Figure 4.17: Maths marks are mostly

43-63, EXCEPT Rishika Batra's 95, which sits far above everyone else's Maths score …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.