If you already worked with time-series data, let me tell you a bit more about the cumulative sum function.
The cumulative sum function is extremely helpful when you want to know what is the sum of a variable over time.
Let me give you an example with E-commerce sales data.
So far so good!
Now that we have the sales volume per month in USD. One could ask the question how much total sales volume have we done so far.
Using the DataFrame.cumsum() we can compute that metric over time.
In Python
Resulting such DataFrame:
And if we plot it,
Here you are! You now know how to compute the cumulative sum of a column with Pandas in Python.
More on DataFrames
If you want to know more about DataFrame and Pandas. Check out the other articles I wrote on the topic, just here :