Q. Given two Dataframes One and Two as shown here:


 One:-
    name    value
0    p    1.0
1    q    2.0
2    r    NaN

 Two:-
    name    value
0    p    1.0
1    q    NaN
2    r    3.0
3    s    4.0

What will be the result of the following?

(a) One.radd(Two)

(b) One + Two

(c) One.rsub(Two)


Answer :-

For both (a) and (b) the output will be like :

>>> One + Two

    name    value
0    pp    2.0
1    qq    NaN
2    rr    NaN
3    NaN    NaN


For (c), Python will raise an error as string values cannot be subtracted.

Post a Comment

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

Previous Post Next Post