experimental.fill() function
The experimental.fill()
function is subject to change at any time.
By using this function, you accept the risks of experimental functions.
The experimental.fill()
function replaces all null values in the _value
column with a non-null value.
import "experimental"
experimental.fill(value: 0.0)
// OR
experimental.fill(usePrevious: true)
Parameters
value
and usePrevious
are mutually exclusive.
value
Value to replace null values with.
Data type must match the type of the _value
column.
usePrevious
When true
, replaces null values with the value of the previous non-null row.
tables
Input data.
Default is piped-forward data (<-
).
Examples
Fill null values with a specified non-null value
import "experimental"
data
|> experimental.fill(value: 0.0)
Input data
_time | _value |
---|---|
2021-01-01T00:00:00Z | 1.2 |
2021-01-01T00:01:00Z | |
2021-01-01T00:02:00Z | 2.3 |
2021-01-01T00:03:00Z | |
2021-01-01T00:04:00Z | 2.8 |
2021-01-01T00:05:00Z | 1.1 |
Output data
_time | _value |
---|---|
2021-01-01T00:00:00Z | 1.2 |
2021-01-01T00:01:00Z | 0.0 |
2021-01-01T00:02:00Z | 2.3 |
2021-01-01T00:03:00Z | 0.0 |
2021-01-01T00:04:00Z | 2.8 |
2021-01-01T00:05:00Z | 1.1 |
Fill null values with the previous non-null value
import "experimental"
data
|> experimental.fill(usePrevious: true)
Input data
_time | _value |
---|---|
2021-01-01T00:00:00Z | 1.2 |
2021-01-01T00:01:00Z | |
2021-01-01T00:02:00Z | 2.3 |
2021-01-01T00:03:00Z | |
2021-01-01T00:04:00Z | 2.8 |
2021-01-01T00:05:00Z | 1.1 |
Output data
_time | _value |
---|---|
2021-01-01T00:00:00Z | 1.2 |
2021-01-01T00:01:00Z | 1.2 |
2021-01-01T00:02:00Z | 2.3 |
2021-01-01T00:03:00Z | 2.3 |
2021-01-01T00:04:00Z | 2.8 |
2021-01-01T00:05:00Z | 1.1 |
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for Flux and this documentation. To find support, use the following resources:
InfluxDB Cloud customers can contact InfluxData Support.