series_fill_backward()series_fill_backward()

在序列中对缺失值执行后向填充内插。Performs a backward fill interpolation of missing values in a series.

包含动态数值数组的表达式为输入。An expression containing dynamic numerical array is the input. 该函数将 missing_value_placeholder 的所有实例替换为离其右侧最近的值(missing_value_placeholder 除外),并返回生成的数组。The function replaces all instances of missing_value_placeholder with the nearest value from its right side (other than missing_value_placeholder), and returns the resulting array. 保留 missing_value_placeholder 的最右侧实例。The rightmost instances of missing_value_placeholder are preserved.

语法Syntax

series_fill_backward(x[, missing_value_placeholder])series_fill_backward(x[, missing_value_placeholder])

  • 将返回序列 x,其中前向填充了 missing_value_placeholder 的所有实例。Will return series x with all instances of missing_value_placeholder filled backwards.

参数Arguments

  • x:动态数组标量表达式(数值数组)。x: dynamic array scalar expression, which is an array of numeric values.
  • missing_value_placeholder:此可选参数为缺失值指定占位符。missing_value_placeholder: this optional parameter specifies a placeholder for missing values. 默认值为“double(null)”。The default value is double(null).

备注Notes

  • 指定“null”作为默认值,以便在 make-series 之后应用任何内插函数:Specify null as the default value to apply any interpolation functions after make-series:
make-series num=count() default=long(null) on TimeStamp from ago(1d) to ago(1h) step 1h by Os, Browser
  • missing_value_placeholder 可以是将要转换为实际元素类型的任何类型。The missing_value_placeholder can be of any type that will be converted to actual element types. double(null)、long(null) 和 int(null) 具有相同的含义。Both double(null), long(null) and int(null) have the same meaning.
  • 如果 missing_value_placeholder 为 double(null) 或被省略(二者含义相同),则结果可能包含 null 值。If missing_value_placeholder is double(null), (or omitted, which have the same meaning) then a result may contain null values. 若要填充这些 null 值,请使用其他内插函数。To fill these null values, use other interpolation functions. 目前只有 series_outliers() 支持在输入数组中使用 null 值。Currently only series_outliers() support null values in input arrays.
  • 此函数会保留数组元素的原始类型。The function preserves original type of array elements.

示例Example

let data = datatable(arr: dynamic)
[
    dynamic([111,null,36,41,null,null,16,61,33,null,null])   
];
data 
| project arr, 
          fill_forward = series_fill_backward(arr)

arr fill_forward
[111,null,36,41,null,null,16,61,33,null,null][111,null,36,41,null,null,16,61,33,null,null] [111,36,36,41,16, 16,16,61,33,null,null][111,36,36,41,16, 16,16,61,33,null,null]

使用 series_fill_forwardseries-fill-const 来完成以上数组的内插。Use series_fill_forward or series-fill-const to complete interpolation of the above array.