You can use DataFrame.prod() :
>>> df = pd.DataFrame(np.random.randint(1, 10, (5, 3))) >>> df 0 1 2 0 7 7 5 1 1 8 6 2 4 8 4 3 2 9 5 4 3 8 7 >>> df.prod(axis=1) 0 245 1 48 2 128 3 90 4 168 dtype: int64
You can also apply np.prod , this was originally done, but usually, when available, direct methods are faster.
>>> df = pd.DataFrame(np.random.randint(1, 10, (5, 3))) >>> df 0 1 2 0 9 3 3 1 8 5 4 2 3 6 7 3 9 8 5 4 7 1 2 >>> df.apply(np.prod, axis=1) 0 81 1 160 2 126 3 360 4 14 dtype: int64
source share