CBSE Class 12 Informatics Practices Question 48 of 101

Python Pandas — II — Question 3

Back to all questions
3
Question

Question 3

The result produced by the functions sub() and rsub() is the same.

Answer

False

Reason — The sub() and rsub() functions produce different results because they subtract the operands in a different order. The sub() function performs element-wise subtraction between two DataFrames, subtracting the right operand from the left operand. The syntax is <DF1>.sub(<DF2>), which means <DF1> - <DF2>. On the other hand, the rsub() function performs element-wise subtraction with the right operand subtracted from the left operand. The syntax is <DF1>.rsub(<DF2>), which means <DF2> - <DF1>.