Loading...

vastorbit.VastFrame.var

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

Aggregates the VastFrame using VAR aggregation (Variance), providing insights into the spread or variability of data for the selected columns. The variance is a measure of how much individual data points deviate from the mean, helping to assess data consistency and variation.

Parameters:
  • columns (SQLColumns, optional) – List of the VastColumns 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 variance for specific columns.

data.var(
    columns = ["x", "y", "z"],
)
variance
"x"64.26785714285714
"y"0.26785714285714285
"z"19.928571428571427
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

VastColumn.kurtosis() : Kurtosis for a specific column.
VastColumn.skewness() : Skewness for a specific column.
VastFrame.std() : Standard Deviation for particular columns.