series_stats()series_stats()

series_stats() 返回多个列中的序列的统计信息。series_stats() returns statistics for a series in multiple columns.

series_stats() 函数接受包含动态数值数组的列作为输入,并计算以下各列:The series_stats() function takes a column containing dynamic numerical array as input and calculates the following columns:

  • min:输入数组中的最小值min: minimum value in the input array
  • min_idx:输入数组中的最小值的第一个位置min_idx: first position of the minimum value in the input array
  • max:输入数组中的最大值max: maximum value in the input array
  • max_idx:输入数组中的最大值的第一个位置max_idx: first position of the maximum value in the input array
  • avg:输入数组的平均值avg: average value of the input array
  • variance:输入数组的样本方差variance: sample variance of input array
  • stdev:输入数组的样本标准偏差stdev: sample standard deviation of the input array

备注

此函数将返回多个列,因此不能将其用作另一个函数的参数。This function returns multiple columns so it can't be used as an argument for another function.

语法Syntax

project series_stats(x [,ignore_nonfinite]) 或 extend series_stats(x) 返回前面提到的所有列,名称如下:series_stats_x_min、series_stats_x_min_idx 等。project series_stats(x [,ignore_nonfinite]) or extend series_stats(x) Returns all above-mentioned columns with the following names: series_stats_x_min, series_stats_x_min_idx and etc.

project (m, mi)=series_stats(x) 或 extend (m, mi)=series_stats(x) 返回以下列:m (min) 和 mi (min_idx)。project (m, mi)=series_stats(x) or extend (m, mi)=series_stats(x) Returns the following columns: m (min) and mi (min_idx).

参数Arguments

  • x:动态数组单元格(数值数组)。x: Dynamic array cell, which is an array of numeric values.
  • ignore_nonfinite:布尔值(可选,默认值:false)标志,该标志指定是否在计算统计信息的同时忽略非有限值(null、NAN、inf 等)。ignore_nonfinite: Boolean (optional, default: false) flag that specifies whether to calculate the statistics while ignoring non-finite values (null, NaN, inf, etc.). 如果设置为 false,则返回的值为 null(如果数组中存在非有限值)。If set to false, the returned values would be null if non-finite values are present in the array.

示例Example

print x=dynamic([23,46,23,87,4,8,3,75,2,56,13,75,32,16,29]) 
| project series_stats(x)

series_stats_x_minseries_stats_x_min series_stats_x_min_idxseries_stats_x_min_idx series_stats_x_maxseries_stats_x_max series_stats_x_max_idxseries_stats_x_max_idx series_stats_x_avgseries_stats_x_avg series_stats_x_stdevseries_stats_x_stdev series_stats_x_varianceseries_stats_x_variance
22 88 8787 33 32.832.8 28.503633853548328.5036338535483 812.457142857143812.457142857143