Skip to main contentSkip to solution

Consider the following DataFrame: 'stationary':

ITNOTYPEPRICEQTY
101PENS200400
109PENCILS100600
120ERASERS300300
111SHARPENERS700100
124PENS10250

State the output of the following command:

stationary[stationary.TYPE=='PENS']['PRICE'].min(numeric_only=True)

Solution

✅ Correct Option: 1

The condition stationary.TYPE=='PENS' keeps only the rows with ITNO 101 and 124. Selecting ['PRICE'] leaves the prices 200 and 10, and min() returns the smaller one, which is 10. Option 1 is the only option that shows just the PRICE minimum, 10.


Options 2, 3 and 4: these list the minimum of several columns (ITNO, QTY and others). That would happen only if min() were applied to the whole filtered DataFrame, but ['PRICE'] selects a single column first.

Keyboard Shortcuts

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