Skip to main contentSkip to solution

S_idPhysicsChemistryMaths
1674587
2586576
3594769
4667971

From the table given above, a DataFrame 'df' is created. What will be the query to fetch maximum marks in chemistry?

Solution

✅ Correct Option: 3

df['Chemistry'] selects the Chemistry column as a Series, and .max() returns the largest value in it. Here the values are 45, 65, 47 and 79, so the result is 79.


Option 1: a DataFrame has no access attribute.

Option 2: max is a method, so it must be called as max(). Writing df.max['Chemistry'] tries to index the method itself and raises an error.

Option 4: iloc selects by integer position, not by label, so 'Chemistry' is not valid. Use loc for labels.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question