vastorbit.VastFrame.mad¶
- VastFrame.mad(columns: Annotated[str | list[str], 'STRING representing one column or a list of columns'] | None = None, **agg_kwargs) TableSample¶
Utilizes the
mad(Median Absolute Deviation) aggregation method with the VastFrame.MADmeasures the dispersion of data points around the median, and it is particularly valuable for assessing the robustness of data in the presence of outliers. When we aggregate the VastFrame usingmad, we gain insights into the variability and the degree to which data points deviate from the median.This is especially useful for datasets where we want to understand the spread of values while being resistant to the influence of extreme outliers. Calculating
madcan involve robust statistical computations, making it a useful tool for outlier-robust analysis and data quality evaluation.Warning
To compute mad, vastorbit needs to execute multiple queries. It necessitates, at a minimum, a query that includes a subquery to perform this type of aggregation. This complexity is the reason why calculating mad is typically slower than some other types of aggregations.
- Parameters:
columns (SQLColumns, optional) – List of the VastColumns names. If empty, all VastColumns are used.
**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 median absolute deviation for specific columns.
data.mad( columns = ["x", "y", "z"], )
mad "x" 8.0 "y" 0.0 "z" 5.0 Rows: 1-3 | Columns: 2Note
All the calculations are pushed to the database.
Hint
For more precise control, please refer to the
aggregatemethod.