Informatics Practices

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

Python Pandas

1 Like

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.

Answered By

2 Likes


Related Questions