Informatics Practices
What is the difference between sum and cumulative sum? How do you perform the two on DataFrame ?
Python Pandas
2 Likes
Answer
The sum provides the total of all numbers in a sequence, while the cumulative sum represents the running total of numbers encountered up to a specific point in the sequence.
The sum() function gives the total sum of values along specified axes, whereas the cumsum() function provides the cumulative sum of values along specified axes, either column-wise or row-wise.
Answered By
3 Likes