vastorbit.VastFrame.count_percent¶
- VastFrame.count_percent(columns: Annotated[str | list[str], 'STRING representing one column or a list of columns'] | None = None, sort_result: bool = True, desc: bool = True, **agg_kwargs) TableSample¶
Performs aggregation on the VastFrame using a list of aggregate functions, including
countandpercent. Thecountfunction computes the number of non-missing (non-null) values within the dataset, providing us with an understanding of the data’s completeness.On the other hand, the
percentfunction calculates the percentage of non-missing values in relation to the total dataset size, offering insights into data integrity and completeness as a proportion.- Parameters:
columns (SQLColumns, optional) – List of VastColumn names. If empty, all VastColumns are used.
sort_result (bool, optional) – If set to True, the result is sorted.
desc (bool, optional) – If set to True and
sort_resultis set to True, the result is sorted in descending order.**agg_kwargs – Any optional parameter to pass to the Aggregate function.
- 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 count percentage for specific columns.
data.count_percent( columns = ["x", "y", "z"], )
count percent "y" 7.0 87.5 "z" 6.0 75.0 "x" 4.0 50.0 Rows: 1-3 | Columns: 3Note
All the calculations are pushed to the database.
Hint
For more precise control, please refer to the
aggregatemethod.