Q. Given a dataframe df as shown below:

 

A

B

C

0

15

17

19

1

16

18

20

2

20

21

22



What will be the result of following code statements?


(a) df['C'] = np.NaN

(b) df['C'] = [2, 5]

(c) df['C'] = [12, 15, 27]


Answer =

(a)

    A   B   C
0  15  17 NaN
1  16  18 NaN
2  20  21 NaN

(b)

ERROR

(c)

    A   B   C
0  15  17  12
1  16  18  15
2  20  21  27


Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post