Python | Pandas Series.cumsum() to find cumulative sum of a Series Last Updated : 31 Oct, 2018 Comments Improve Suggest changes Like Article Like Report Pandas Series.cumsum() is used to find Cumulative sum of a series. In cumulative sum, the length of returned series is same as input and every element is equal to sum of all previous elements. Syntax: Series.cumsum(axis=None, skipna=True) Parameters: axis: 0 or 'index' for row wise operation and 1 or 'columns' for column wise operation skipna: Skips NaN addition for elements after the very next one if True. Result type: Series Example #1: In this example, a series is created from a Python list using Pandas .Series() method. The list also contains a Null value and the skipna parameter is kept default, that is True. Python3 # importing pandas module import pandas as pd # importing numpy module import numpy as np # making list of values values = [3, 4, np.nan, 7, 2, 0] # making series from list series = pd.Series(values) # calling method cumsum = series.cumsum() # display cumsum Output: 3 7 NaN 14 16 16 dtype: float64 Explanation Cumulative sum is sum of current and all previous values. As shown in above output, the addition was done as follows 3 3+4 = 7 7+NaN = NaN 7+7 = 14 14+2 = 16 16+0 = 16 Example #2: skipna=False In this example, a series is created just like in the above example. But the skipna parameter is kept False. Hence NULL values won't be ignored and it would be added every time after it's occurrence. Python3 1== # importing pandas module import pandas as pd # importing numpy module import numpy as np # making list of values values = [1, 20, 13, np.nan, 0, 1, 5, 23] # making series from list series = pd.Series(values) # calling method cumsum = series.cumsum(skipna = False) # display cumsum Output: 0 1.0 1 21.0 2 34.0 3 NaN 4 NaN 5 NaN 6 NaN 7 NaN dtype: float64 Explanation: As it can be seen in output, all the values after first occurrence of NaN are also NaN since any number + NaN is also NaN. Comment More infoAdvertise with us Next Article Python | Pandas Series.cummin() to find cumulative minimum of a series K Kartikaybhutani Follow Improve Article Tags : Python Python-pandas Python pandas-series Python pandas-series-methods Practice Tags : python Similar Reads Python | Pandas Series.cummin() to find cumulative minimum of a series Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric Python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas Series.cummin() is used to find Cumulative minimum of a series. In cumulative m 2 min read Python | Pandas Series.cummin() to find cumulative minimum of a series Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric Python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas Series.cummin() is used to find Cumulative minimum of a series. In cumulative m 2 min read Python | Pandas series.cummax() to find Cumulative maximum of a series Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric Python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas Series.cummax() is used to find Cumulative maximum of a series. In cumulative m 3 min read Python | Pandas series.cummax() to find Cumulative maximum of a series Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric Python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas Series.cummax() is used to find Cumulative maximum of a series. In cumulative m 3 min read Python | Pandas series.cumprod() to find Cumulative product of a Series Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric Python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas Series.cumprod() is used to find Cumulative product of a series. In cumulative 3 min read Python | Pandas series.cumprod() to find Cumulative product of a Series Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric Python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas Series.cumprod() is used to find Cumulative product of a series. In cumulative 3 min read Like