(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:
| Name | English | Maths | Hindi | Science | Social_Studies |
|---|---|---|---|---|---|
| Rishika Batra | 95 | 95 | 90 | 94 | 95 |
| Waseem Ali | 95 | 76 | 79 | 77 | 89 |
| Kulpreet Singh | 78 | 81 | 75 | 76 | 88 |
| Annie Mathews | 88 | 63 | 67 | 77 | 80 |
| Shiksha | 95 | 55 | 51 | 59 | 80 |
| Naveen Gupta | 82 | 55 | 63 | 56 | 74 |
| Taleem Ahmed | 73 | 49 | 54 | 60 | 77 |
| Pragati Nigam | 80 | 50 | 51 | 54 | 76 |
| Usman Abbas | 92 | 43 | 51 | 48 | 69 |
| Gurpreet Kaur | 60 | 43 | 55 | 52 | 71 |
| Sameer Murthy | 60 | 43 | 55 | 52 | 71 |
| Angelina | 78 | 33 | 39 | 48 | 68 |
| Angad Bedi | 62 | 43 | 51 | 48 | 54 |
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
pd.read_csv('Marks.csv')loads Table 4.8's six numeric mark columns (English, Maths, Hindi, Science, Social_Studies) plus the non-numericNamecolumn.df.plot(kind='box')box-plots every NUMERIC column in one call;Nameis skipped the same way it would be for a histogram, since a box plot needs a numeric distribution per box.- 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.