Advertisements
Advertisements
Question
Assertion (A): The output of addition of two series will be NaN, if one of the elements or both the elements have no value(s).
Reason (R): While performing mathematical operations on a series, by default all missing values are filled in with 0.
Options
Both (A) and (R) are true and (R) is the correct explanation for (A).
Both (A) and (R) are true and (R) is not the correct explanation for (A).
(A) is true and (R) is false.
(A) is false but (R) is true.
MCQ
Assertion and Reasoning
Solution
(A) is true and (R) is false.
Explanation:
- Assertion (A): If one or both elements have no values, the addition of two series will produce NaN.
True: When adding two series in pandas, missing values (NaN) in any series will result in NaN in the output by default. - Reason (R): When executing mathematical operations on a series, all missing values are automatically filled up with zero.
False: Missing values are not automatically replaced with 0 unless expressly stated by methods such as fillna().
shaalaa.com
Is there an error in this question or solution?