In [1]:
from pandas import DataFrame

This is the data frame you are given

In [2]:
# Create some data
d = [[2,2],[7,3]]
d
Out[2]:
[[2, 2], [7, 3]]
In [3]:
# Create the data frame
frm = DataFrame(data=d)
frm
Out[3]:
0 1
0 2 2
1 7 3

This is the data frame you have to replicate

  • Create a sum column
  • The values are equal to the row sum

    i.e. 2 + 2 = 4

In [4]:
ans = {0:[2,7],
       1:[2,3],
       'sum':[4,10]
       }
frm_ans = DataFrame(data=ans)
frm_ans
Out[4]:
0 1 sum
0 2 2 4
1 7 3 10

Start Coding...

In [4]:
 
In [4]:
 

How check your answer?

The correct answer will have "True" on all the rows.

In [5]:
# "Yout data frame" == frm
frm_ans == frm_ans
Out[5]:
0 1 sum
0 True True True
1 True True True