Explore Library
Code QuizAdvanced

Dropping Missing Rows in Pandas

Spot the bug in a pandas snippet meant to remove rows with missing values.

Codepython
import pandas as pd

df = pd.DataFrame({
    'name': ['Ana', 'Ben', None, 'Dan'],
    'age':  [25, None, 30, 40]
})

# Remove rows that contain missing values
df.dropna()

print(df)

What is the bug in this code that prevents the missing rows from being removed?