CBSE Class 12 Informatics Practices Question 28 of 101

Python Pandas — II — Question 4

Back to all questions
4
Question

Question 4

To subtract the values of two DataFrames, ............... function may be used.

  1. sub
  2. difference
  3. minus
  4. rsub
Answer

sub, rsub

Reason — We can subtract two DataFrame objects using either (-) operator or using sub() function as per syntax : <DF1>.sub(<DF2>) which means <DF1>-<DF2> or by using rsub() function i.e., reverse subtract as per syntax : <DF1>.rsub(<DF2>) which means <DF2>-<DF1>.