bigframes.pandas.DataFrame.prod#

DataFrame.prod(axis: str | int = 0, *, numeric_only: bool = False) Series[source]#

Return the product of the values over the requested axis.

Examples:

>>> import bigframes.pandas as bpd
>>> df = bpd.DataFrame({"A": [1, 2, 3], "B": [4.5, 5.5, 6.5]})
>>> df
    A    B
0   1  4.5
1   2  5.5
2   3  6.5

[3 rows x 2 columns]

Calculating the product of each column(the default behavior without an explicit axis parameter):

>>> df.prod()
A        6.0
B    160.875
dtype: Float64

Calculating the product of each row:

>>> df.prod(axis=1)
0     4.5
1    11.0
2    19.5
dtype: Float64
Parameters:
  • axis ({index (0), columns (1)}) – Axis for the function to be applied on. For Series this parameter is unused and defaults to 0.

  • numeric_only (bool. default False) – Include only float, int, boolean columns.

Returns:

Series with the product of the values.

Return type:

bigframes.pandas.Series