Puzzle 11: fillna()? Phil? Nah!

Let's solve a fillna() puzzle.

We'll cover the following

Guess the output

Try to guess the output of the code below:

Press + to interact
import numpy as np
import pandas as pd
s = pd.Series([1, 2, np.nan, 4, 5])
s.fillna(3)
print(s.sum())

Quiz

Q

What is the output of the code above?

A)

15.0

B)

nan

C)

12.0

D)

TypeError

Get hands-on with 1300+ tech skills courses.