Q. Consider the data-frames One and Two given in. What will be the output of following statements:-
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
(a)
pd.concat( [One, Two])
(b)
pd.concat( [One, Two], axis = 1)
(c)
pd.merge (One, Two, on = 'name')
Answer :-
(a)
name value
0 p 1.0
1 q 2.0
2 r NaN
0 p 1.0
1 q NaN
2 r 3.0
3 s 4.0
(b)
name value name value
0 p 1.0 p 1.0
1 q 2.0 q NaN
2 r NaN r 3.0
3 NaN NaN s 4.0
(c)
name value_x value value_y
0 p 1.0 1.0
1 q 2.0 NaN
2 r NaN 3.0
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )