Examples
import numpy as np
import pandas as pd
df = pd.DataFrame([[3.0, 2.0],
[5.0, np.nan],
[2.0, 0.0]],
columns=list('XY'))
df
By default, iterates over rows and finds the product in each column:
df.cumprod()
To iterate over columns and find the product in each row, use axis=1
df.cumprod(axis=1)