verticapy.vDataColumn.aad#
- vDataColumn.aad() bool | float | str | timedelta | datetime #
Utilizes the
aad
(Average Absolute Deviation) aggregation method to analyze the vDataColumn.AAD
measures the average absolute deviation of data points from their mean, offering valuable insights into data variability and dispersion. When we aggregate the vDataColumn usingaad
, we gain an understanding of how data points deviate from the mean on average, which is particularly useful for assessing data spread and the magnitude of deviations.This method is valuable in scenarios where we want to evaluate data variability while giving equal weight to all data points, regardless of their direction of deviation. Calculating
aad
provides us with information about the overall data consistency and can be useful in various analytical and quality assessment contexts.Warning
To compute aad, VerticaPy 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 aad is typically slower than some other types of aggregations.
Returns#
- PythonScalar
aad
Examples#
For this example, let’s generate a dataset and calculate the average absolute deviation 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["x"].aad() Out[3]: 6.46875
Note
All the calculations are pushed to the database.
Hint
For more precise control, please refer to the
aggregate
method.