Loading...

verticapy.vDataFrame.count#

vDataFrame.count(columns: str | list[str] | None = None, **agg_kwargs) TableSample#

This operation aggregates the vDataFrame using the COUNT aggregation, providing the count of non-missing values for specified columns. This is valuable for assessing data completeness and quality.

Parameters#

columns: SQLColumns, optional

List of the vDataColumns names. If empty, all vDataColumns are used.

**agg_kwargs

Any optional parameter to pass to the Aggregate function.

Returns#

TableSample

result.

Examples#

For this example, we will use the following dataset:

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],
    }
)

Now, let`s calculate the count for specific columns.

data.count(
    columns = ["x", "y", "z"],
)
count
"x"8.0
"y"8.0
"z"8.0

Note

All the calculations are pushed to the database.

Hint

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

See also

vDataColumn.count() : Count for a specific column.
vDataFrame.count_percent() : Count Percent for particular columns.