Consider the following DataFrame: 'stationary':
ITNO TYPE PRICE QTY 101 PENS 200 400 109 PENCILS 100 600 120 ERASERS 300 300 111 SHARPENERS 700 100 124 PENS 10 250
State the output of the following command:
stationary[stationary.TYPE=='PENS']['PRICE'].min(numeric_only=True)
Consider the following DataFrame: 'stationary':
| ITNO | TYPE | PRICE | QTY |
|---|---|---|---|
| 101 | PENS | 200 | 400 |
| 109 | PENCILS | 100 | 600 |
| 120 | ERASERS | 300 | 300 |
| 111 | SHARPENERS | 700 | 100 |
| 124 | PENS | 10 | 250 |
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.
Related questions:
2025: 15 May Shift 2
2025: 3 June Shift 2
2025: 15 May Shift 2