Q.Calculate the mode of marks scored in Maths.
[Table: The chapter's case study (Program 3.1) stores unit test marks of 4 students (maximum marks 25 in each subject) in a DataFrame df created from the dictionary marksUT = {'Name':['Raman','Raman','Raman','Zuhaire','Zuhaire','Zuhaire','Ashravy','Ashravy','Ashravy','Mishti','Mishti','Mishti'], 'UT':[1,2,3,1,2,3,1,2,3,1,2,3], 'Maths':[22,21,14,20,23,22,23,24,12,15,18,17], 'Science':[21,20,19,17,15,18,19,22,25,22,21,18], 'S.St':[18,17,15,22,21,19,20,24,19,25,25,20], 'Hindi':[20,22,24,24,25,23,15,17,21,22,24,25], 'Eng':[21,24,23,19,15,13,22,21,23,22,23,20]}.]
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 →The mode of marks scored in Maths is the value that appears most frequently in the Maths column of the DataFrame. We extract that column, count occurrences, and find the highest frequency value.
This is a plain theory question with a code task — you need to compute the mode from the given DataFrame. The mode is a statistical measure: the value that occurs most often in a dataset. For marks scored in Maths, we look at all 12 entries in the Maths column and find which mark appears the most times.
Let's first understand the data. The DataFrame df has 12 rows, one for each student's performance in each unit test (UT 1, 2, 3). The Maths column contains these marks: 22, 21, 14, 20, 23, 22, 23, 24, 12, 15, 18, 17.
Now, count the frequency of each mark:
- 22 appears twice (Raman UT1, Zuhaire UT2)
- 21 appears once (Raman UT2)
- 14 appears once (Raman UT3)
- 20 appears once (Zuhaire UT1)
- 23 appears twice (Zuhaire UT3, Ashravy UT1)
- 24 appears once (Ashravy UT2)
- 12 appears once (Ashravy UT3)
- 15 appears once (Mishti UT1)
- 18 appears once (Mishti UT2)
- 17 appears once (Mishti UT3)
The highest frequency is 2, and two marks share that frequency: 22 and 23. So the dataset is bimodal — there are two modes.
In Python with pandas, you'd compute this as:
import pandas as pd
# Create the DataFrame as given
marksUT = {'Name':['Raman','Raman','Raman','Zuhaire','Zuhaire','Zuhaire','Ashravy','Ashravy','Ashravy','Mishti','Mishti','Mishti'],
'UT':[1,2,3,1,2,3,1,2,3,1,2,3],
'Maths':[22,21,14,20,23,22,23,24,12,15,18,17],
'Science':[21,20,19,17,15,18,19,22,25,22,21,18],
'S.St':[18,17,15,22,21,19,20,24,19,25,25,20], …
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.