Loading...

verticapy.vDataColumn.sum#

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

Aggregates the vDataFrame using SUM aggregation, which computes the total sum of values for the specified columns, providing a cumulative view of numerical data.

Returns#

PythonScalar

sum

Examples#

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

Note

All the calculations are pushed to the database.

Hint

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

See also

vDataFrame.sum() : Sum for particular columns.
vDataColumn.max() : Maximum for a specific colum.