Q.Write the statements to display the minimum marks obtained by a particular student 'Mishti' in all the unit tests for each subject.
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 →Select only Mishti's rows with a Boolean mask, then take .min() on just the five subject columns — the subject list is given explicitly on purpose, so the (numerically meaningless) UT column doesn't get mixed into the result.
Step 1 — filter to Mishti's rows
dfMishti = df.loc[df.Name == 'Mishti']
print('\nMarks obtained by Mishti in all the Unit Tests\n\n', dfMishti)
Output:
Marks obtained by Mishti in all the Unit Tests
Name UT Maths Science S.St Hindi Eng
9 Mishti 1 15 22 25 22 22
10 Mishti 2 18 21 25 24 23
11 Mishti 3 17 18 20 25 20
Step 2 — minimum across her 3 rows, subject by subject
dfMishtiMarks = dfMishti[['Maths','Science','S.St','Hindi','Eng']]
print(dfMishtiMarks.min())
Output:
Maths 15
Science 18
S.St 20
Hindi 22
Eng 20
dtype: int64
Why the subject columns are named explicitly
dfMishti.min() (with no column selection) would return a value for every column, including UT (whose minimum, 1, is a test number, not a mark) and Name (whose "minimum" would just be the constant text 'Mishti', since all three rows share it). Neither is useful here — the question only wants the lowest mark per subject. Naming ['Maths','Science','S.St','Hindi','Eng'] explicitly keeps the result to exactly the five real subjects, matching the answer the textbook itself gives.
How this differs from the overall class minimum
Compare Mishti's own minimums above to df.min() computed over the whole class (all 12 rows, no filter):
print(df.min())
Name Ashravy
UT 1
Maths 12
Science 15
S.St 15
Hindi 15
Eng 13
dtype: object
``` …
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.