@antv/data-wizard
Version:
A js/ts library for data processing
153 lines (151 loc) • 5.1 kB
TypeScript
/**
* Return the minimum of the array.
* @param array - The array to process
*/
export declare function min(array: number[]): number;
/**
* Return the minimum index of the array.
* @param array - The array to process
*/
export declare function minIndex(array: number[]): number;
/**
* Return the maximum of the array.
* @param array - The array to process
*/
export declare function max(array: number[]): number;
/**
* Return the maximum index of the array.
* @param array - The array to process
*/
export declare function maxIndex(array: number[]): number;
/**
* Return the sum of the array.
* @param array - The array to process
*/
export declare function sum(array: number[]): number;
/**
* Return the mean of the array.
* @param array - The array to process
*/
export declare function mean(array: number[]): number;
/**
* Return the geometricMean of the array.
* @param array - The array to process
*/
export declare function geometricMean(array: number[]): number;
/**
* Return the harmonicMean of the array.
* @param array - The array to process
*/
export declare function harmonicMean(array: number[]): number;
/**
* Return the median of the array.
* @param array - The array to process
*/
export declare function median(array: number[], sorted?: boolean): number;
/**
* Return the quartile of the array.
* @param array - The array to process
* @param sorted - Whether it is sorted
*/
export declare function quartile(array: number[], sorted?: boolean): [number, number, number];
/**
* Return the quantile of the array.
* @param array - The array to process
* @param percent - percent
* @param sorted - Whether it is sorted
*/
export declare function quantile(array: number[], percent: number, sorted?: boolean): number;
/**
* Return the variance of the array.
* @param array - The array to process
*/
export declare function variance(array: number[]): number;
/**
* Return the standard deviation of the array.
* @param array - The array to process
*/
export declare function standardDeviation(array: number[]): number;
/**
* Return the coefficient of variance of the array.
* @param array - The array to process
*/
export declare function coefficientOfVariance(array: number[]): number;
/**
* Return the covariance of the array.
* @param array - The array to process
*/
export declare function covariance(x: number[], y: number[]): number;
/**
* Return the Pearson CorrelationCoefficient of two array.
*/
export declare function pearson(x: number[], y: number[]): number;
/**
* Return the counts of valid value in the array.
* @param array - The array to process
*/
export declare function valid(array: any[]): number;
/**
* Return the counts of missing value in the array.
* @param array - The array to process
*/
export declare function missing(array: any[]): number;
/**
* Return the counts of each distinct value in the array.
* @param array - The array to process
*/
export declare function valueMap(array: any[]): Record<string, number>;
/**
* Return the counts of distinct value in the array.
* @param array - The array to process
*/
export declare function distinct(array: any[]): number;
/**
* Return the sum of the array by specific measure.
* @param array - The array to process
* @param measure - The selected measure
*/
export declare function sumBy(array: any[], measure: string): any;
/**
* Return the count of the array by specific measure.
* @param array - The array to process
* @param measure - The selected measure
*/
export declare function countBy(array: any[], measure: string): number;
/**
* Return the maximum of the array by specific measure.
* @param array - The array to process
* @param measure - The selected measure
*/
export declare function maxBy(array: any[], measure: string): number;
/**
* Return the minimum of the array by specific measure.
* @param array - The array to process
* @param measure - The selected measure
*/
export declare function minBy(array: any[], measure: string): number;
/**
* Return the mean of the array by specific measure.
* @param array - The array to process
* @param measure - The selected measure
*/
export declare function meanBy(array: any[], measure: string): number;
/**
* Return the groups of the array.
* @param array - The array to process
* @param measure - The selected measure
*/
export declare function groupBy(array: any[], measure: string): any;
export declare type AggregateMethod = 'SUM' | 'COUNT' | 'MAX' | 'MIN' | 'MEAN';
export declare type Aggregator = (data: any, measure: string) => number;
export declare const AggregatorMap: Record<AggregateMethod, Aggregator>;
/**
* Aggregate data via different aggregation methods
* @param array - The array to process
* @param dimensionField - The selected dimensions
* @param measure - The selected measure
* @param aggMethod - The selected aggregation method
* @param seriesField - The selected series
* @returns
*/
export declare function aggregate(array: any[], dimensionField: string, measure: string, aggMethod?: AggregateMethod, seriesField?: string): any[];