Special functions
_
fill_missing (expression, <first_fill>, <last_fill>, <fill_value>)
_
To better understand this function, suppose you have a set of variables that you want to sum.
Variables A, B, C, and D do not have data for all timestamps, as shown in the table below. Use the fill_missing() function to fill the gaps and perform the calculation. The following examples are based on this table:
07/12/2020 00:00:04
5
-
4
5
07/12/2020 00:00:03
3
2
3
4
07/12/2020 00:00:02
-
4
-
2
07/12/2020 00:00:01
4
3
5
-
_
By default, the fill_missing() expression sets the first_fill parameter to "ffill". This means the function fills the gaps forward, starting at a point where it has enough data to fill the gaps for all involved time series. The result is as follows:
07/12/2020 00:00:04
5
2
4
5
16
07/12/2020 00:00:03
3
2
3
4
12
07/12/2020 00:00:02
4
4
5
2
15
07/12/2020 00:00:01
4
3
5
-
-
__
You can also set first_fill to "bfill". In that case, the gaps are filled as follows:
07/12/2020 00:00:04
5
-
4
5
-
07/12/2020 00:00:03
3
2
3
4
12
07/12/2020 00:00:02
3
4
3
2
12
07/12/2020 00:00:01
4
3
5
2
14
___
Suppose you need to fill all gaps in the variables. In that case, set both first_fill and last_fill in the expression. The result is as follows:
07/12/2020 00:00:04
5
2
4
5
16
07/12/2020 00:00:03
3
2
3
4
12
07/12/2020 00:00:02
4
4
5
2
15
07/12/2020 00:00:01
4
3
5
2
14
__
You can also fill the gaps with a fixed value. In this case, the function sets 0 in every gap in the variables.
07/12/2020 00:00:04
5
0
4
5
14
07/12/2020 00:00:03
3
2
3
4
12
07/12/2020 00:00:02
0
4
0
2
6
07/12/2020 00:00:01
4
3
5
0
12
6
where(condition, operation if true, operation if false)
Step function:
Assume a variable
Interval function:
Assume a variable
diff(<variable>, <steps>)
Assume a variable
shift(<variable>,<step>)
Assume a variable
This lets you retrieve the previous value of the variable by shifting the series to the left.
Assume a variable
Shifts the series to the right.
Last updated
Was this helpful?