Series.cumprod() is used to find the cumulative product of a series. In the cumulative product, the length of the returned series is the same as that of the input series, and each element is equal to the product of the current and all previous values.
Syntax: Series.cumprod (axis = None, skipna = True)
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.
Return type: Series p>
Example # 1:
This example creates a series from a Python list. The list also contains a Null value, and the
skipna parameter remains the default, which is True.
0 9.0 1 36.0 2 1188.0 3 NaN 4 NaN 5 NaN 6 NaN 7 NaN dtype: float64
Explanation: b> As in the previous example, the product of the current and all previous values was returned at each position. Since the multiplication of NaN by anything is also NaN, and the skipna parameter was stored to False, hence all values after NaN appear are also NaN.
Vincent Bumgarner has been designing software for nearly 20 years, working in many languages on nearly as many platforms. He started using Splunk in 2007 and has enjoyed watching the product evolve ov...
Learning to code is tremendous fun as you can get instant results, no matter how much more you have to learn. In fact, it’s such fun creating games and programs that it feels effortless once you’r...
Learning Correct Cryptography by Example. The interconnected world of the current era has drastically changed everything, including banking, entertainment, and even statecraft. Despite difference...
While there is no arguing about the staying power of the cloud model and the benefits it can bring to any organization or government, mainstream adoption depends on several key variables falling into ...