Loading...

verticapy.vDataColumn.product#

vDataColumn.product() bool | float | str | timedelta | datetime#

Aggregates the vDataColumn by applying the product aggregation function. This function computes the product of values within the dataset, providing insights into the multiplication of data points.

The product aggregation can be particularly useful when we need to assess cumulative effects or when multiplying values is a key aspect of the analysis. This operation can be relevant in various domains, such as finance, economics, and engineering, where understanding the combined impact of values is critical for decision-making and modeling.

Note

Since product is not a conventional SQL aggregation, we employ a unique approach by combining the sum of logarithms and the exponential function for its computation. This non-standard methodology is utilized to derive the product of values within the dataset, offering a distinctive way to understand the multiplicative effects of data points.

Returns#

PythonScalar

product

Examples#

For this example, let’s generate a dataset and calculate the product of a column:

import verticapy as vp

data = vp.vDataFrame(
    {
        "x": [1, 2, 4, 9, 10, 15, 20, 22],
        "y": [1, 2, 1, 2, 1, 1, 2, 1],
        "z": [10, 12, 2, 1, 9, 8, 1, 3],
    }
)


data["x"].product()
Out[3]: 4752000.0

Note

All the calculations are pushed to the database.

Hint

For more precise control, please refer to the aggregate method.

See also

vDataColumn.aggregate() : Aggregations for a specific column.
vDataColumn.quantile() : Quantile Aggregates for a specific column.