Loading...

verticapy.vDataColumn.avg#

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

This operation aggregates the vDataFrame using the AVG aggregation, which calculates the average value for the input column. It provides insights into the central tendency of the data and is a fundamental statistical measure often used in data analysis and reporting.

Returns#

PythonScalar

average

Examples#

For this example, let’s generate a dataset and calculate the average 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"].avg()
Out[3]: 10.375

Note

All the calculations are pushed to the database.

Hint

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

See also

vDataFrame.avg() : Aggregations for particular columns.
vDataFrame.max() : Maximum for particular columns.
vDataFrame.min() : Minimum for particular columns.