Q. Consider following dataframes, namely Sprices1 and Sprices2 storing prices closing 1 year apart.
Sprices1
closingPrice
05-01 531.35
05-02 527.93
05-03 NaN
05-04 NaN
05-05 527.81
05-06 515.14
05-07 509.96
Sprices2
closingPrice
05-01 631.35
05-02 427.93
05-03 805
05-04 NaN
05-05 267.81
05-06 455.14
05-07 NaN
What will be the output produced by the following code fragments?
(a)
print(Sprices1.isnull())
print(Sprices1.notnull()
(b)
pd.merge (Sprices1, Sprices2)
pd.merge(Sprices2, Sprices1)
(c)
pandas.concat(Sprices1, Sprices2)
Answer =
(a)
>>> print(sprices1.isnull())
closingPrice
05-01 False
05-02 False
05-03 True
05-04 True
05-05 False
05-06 False
05-07 False
>>> print(sprices1.notnull())
closingPrice
05-01 True
05-02 True
05-03 False
05-04 False
05-05 True
05-06 True
05-07 True
(b)
>>> pd.merge(sprices1,sprices2)
closingPrice
0 NaN
1 NaN
2 NaN
3 NaN
>>> pd.merge(sprices2,sprices1)
closingPrice
0 NaN
1 NaN
2 NaN
3 NaN
(c) ERROR
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )