GPUdb.aggregate_statistics( table_name = None, column_name = None, stats = None,
options = {} )
Calculates the requested statistics of a given column in a given table.
The available statistics are count (number of total objects), mean, stdv (standard deviation), variance, skew, kurtosis, sum, min, max, weighted_average, cardinality (unique count), estimated cardinality, percentile and percentile_rank.
Estimated cardinality is calculated by using the hyperloglog approximation technique.
Percentiles and percentile_ranks are approximate and are calculated using the t-digest algorithm. They must include the desired percentile/percentile_rank. To compute multiple percentiles each value must be specified separately (i.e. 'percentile(75.0),percentile(99.0),percentile_rank(1234.56),percentile_rank(-5)').
The weighted average statistic requires a weight_attribute to be specified in input parameter options. The weighted average is then defined as the sum of the products of input parameter column_name times the weight attribute divided by the sum of the weight attribute.
The response includes a list of the statistics requested along with the count of the number of items in the given set.
Input Parameter Description
Name | Type | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
table_name | str | Name of the table on which the statistics operation will be performed. | ||||||||||||||||||||||||||||||
column_name | str | Name of the column for which the statistics are to be calculated. | ||||||||||||||||||||||||||||||
stats | str | Comma separated list of the statistics to calculate, e.g. "sum,mean".
|
||||||||||||||||||||||||||||||
options | dict of str | Optional parameters. Default value is an empty dict ( {} ).
|
Output Parameter Description
Name | Type | Description |
---|---|---|
stats | dict of floats | (statistic name, double value) pairs of the requested statistics, including the total count by default. |