Loading...

vastorbit.VastFrame.product

VastFrame.product(columns: Annotated[str | list[str], 'STRING representing one column or a list of columns'] | None = None, **agg_kwargs) TableSample

Aggregates the VastFrame 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.

Parameters:
  • columns (SQLColumns, optional) – List of the VastColumn names. If empty, all numerical VastColumns are used.

  • **agg_kwargs – Any optional parameter to pass to the Aggregate function.

Returns:

result.

Return type:

TableSample

Examples

For this example, we will use the following dataset:

import vastorbit as vo

data = vo.VastFrame(
    {
        "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],
    }
)

Now, let’s calculate the product for specific columns.

data.product(
    columns = ["x", "y", "z"],
)
prod
"x"4752000.000000011
"y"7.999999999999999
"z"51840.000000000015
Rows: 1-3 | Columns: 2

Note

All the calculations are pushed to the database.

Hint

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

See also

VastFrame.aggregate() : Aggregates for particular columns.
VastFrame.quantile() : Quantile Aggregates for particular columns.