vastorbit.VastColumn.value_counts¶
- VastColumn.value_counts(k: int = 30) TableSample¶
This function returns the k most frequently occurring elements in a column, along with information about how often they occur. Additionally, it provides various statistical details to give you a comprehensive view of the data distribution.
- Parameters:
k (int, optional) – Number of most occurent elements to return.
- Returns:
result.
- Return type:
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 values and counts for a specific column.
data["x"].value_counts(k = 6)
value name "x" dtype integer unique 8.0 count 8.0 1 1 Others 1 9 1 15 1 2 1 4 1 22 1 Rows: 1-11 | Columns: 2Note
All the calculations are pushed to the database.
Hint
For more precise control, please refer to the
aggregatemethod.See also
VastColumn.nunique(): Cardinality for a specific column.VastFrame.duplicated(): Duplicated values for particular columns.