Puzzle 24: Late Addition

Let's solve a pandas DataFrame puzzle with columns.

We'll cover the following

Guess the output

Try to guess the output of the code below:

Press + to interact
import pandas as pd
df = pd.DataFrame([
['Sterling', 83.4],
['Cheryl', 97.2],
['Lana', 13.2],
], columns=['name', 'sum'])
df.late_fee = 3.5
print(df)

Quiz

Q

What is the output of the code above?

A)
       name   sum  late_fee
0  Sterling  83.4       3.5
1    Cheryl  97.2       3.5
2      Lana  13.2       3.5
B)
       name   sum  late_fee
0  Sterling  83.4      
1    Cheryl  97.2      
2      Lana  13.2      
C)
       name   sum
0  Sterling  83.4
1    Cheryl  97.2
2      Lana  13.2
D)

SyntaxError

Get hands-on with 1300+ tech skills courses.