Skip to main contentSkip to solution

Consider the following 'SeriesA' and 'SeriesB':

SeriesA

Index
a2
b4
c0
d8
e0
f10

SeriesB

Index
a10
b-20
c-5
d10
e100
f50

What will be the output of SeriesA * SeriesB?

Solution

✅ Correct Option: 3

Multiplying two pandas Series works element by element, matched on the index labels. Both series have the same index (a to f), so no NaN appears from mismatched labels.

IndexSeriesASeriesBProduct
a21020
b4-20-80
c0-50
d81080
e01000
f1050500

Note that 0×(−5)=00 \times (-5) = 0, which is not -0 or NaN, so the output is the same as Option 3.


Options 1, 2 and 4: NaN appears only when an index label is missing from one series, or when a value is itself NaN. A zero value gives 0, not NaN.

Keyboard Shortcuts

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