CBSE Class 12 Informatics Practices Question 1 of 21

Python Pandas — II — Question 16

Back to all questions
16
Question

Question 16

To calculative cumulative sum of a column of a DataFrame, you may use ............... function.

  1. sum()
  2. sum(cumulative = True)
  3. cumsum()
  4. none of these
Answer

cumsum()

Reason — The cumsum() function in pandas is used to calculate the cumulative sum of a column in a DataFrame i.e., in the output of this function, the value of each row is replaced by the sum of all prior rows, including this row.

Get the Bright Tutorials app Stuck on a question? Ask Bright Buddy — your AI tutor — for step-by-step help in the app.