Loading...

verticapy.vDataColumn.distinct#

vDataColumn.distinct(**kwargs) list#

This function returns the distinct categories or unique values within a vDataColumn. It’s a valuable method for exploring the unique elements within a column, which can be particularly useful when working with categorical data.

Returns#

list

Distinct categories of the vDataColumn.

Examples#

For this example, let’s generate a dataset and compute all the distinct elements 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["y"].distinct()
Out[3]: [1, 2]

Note

All the calculations are pushed to the database.

Hint

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

See also

vDataColumn.aggregate() : Aggregations for a specific column.
vDataFrame.aggregate() : Aggregates for particular columns.