content/flux/v0/stdlib/experimental/fill.md
experimental.fill() replaces all null values in the _value column with a non-null value.
(<-tables: stream[{B with _value: A}], ?usePrevious: bool, ?value: A) => stream[{B with _value: A}]
{{% caption %}} For more information, see Function type signatures. {{% /caption %}}
Value to replace null values with.
Data type must match the type of the _value column.
Replace null values with the value of the previous non-null row.
Input data. Default is piped-forward data (<-).
import "experimental"
import "sampledata"
sampledata.int(includeNull: true)
|> experimental.fill(value: 0)
{{< expand-wrapper >}} {{% expand "View example input and output" %}}
| _time | _value | *tag |
|---|---|---|
| 2021-01-01T00:00:00Z | -2 | t1 |
| 2021-01-01T00:00:10Z | t1 | |
| 2021-01-01T00:00:20Z | 7 | t1 |
| 2021-01-01T00:00:30Z | t1 | |
| 2021-01-01T00:00:40Z | t1 | |
| 2021-01-01T00:00:50Z | 4 | t1 |
| _time | _value | *tag |
|---|---|---|
| 2021-01-01T00:00:00Z | t2 | |
| 2021-01-01T00:00:10Z | 4 | t2 |
| 2021-01-01T00:00:20Z | -3 | t2 |
| 2021-01-01T00:00:30Z | 19 | t2 |
| 2021-01-01T00:00:40Z | t2 | |
| 2021-01-01T00:00:50Z | 1 | t2 |
| _time | _value | *tag |
|---|---|---|
| 2021-01-01T00:00:00Z | -2 | t1 |
| 2021-01-01T00:00:10Z | 0 | t1 |
| 2021-01-01T00:00:20Z | 7 | t1 |
| 2021-01-01T00:00:30Z | 0 | t1 |
| 2021-01-01T00:00:40Z | 0 | t1 |
| 2021-01-01T00:00:50Z | 4 | t1 |
| _time | _value | *tag |
|---|---|---|
| 2021-01-01T00:00:00Z | 0 | t2 |
| 2021-01-01T00:00:10Z | 4 | t2 |
| 2021-01-01T00:00:20Z | -3 | t2 |
| 2021-01-01T00:00:30Z | 19 | t2 |
| 2021-01-01T00:00:40Z | 0 | t2 |
| 2021-01-01T00:00:50Z | 1 | t2 |
{{% /expand %}} {{< /expand-wrapper >}}
import "experimental"
import "sampledata"
sampledata.int(includeNull: true)
|> experimental.fill(usePrevious: true)
{{< expand-wrapper >}} {{% expand "View example input and output" %}}
| _time | _value | *tag |
|---|---|---|
| 2021-01-01T00:00:00Z | -2 | t1 |
| 2021-01-01T00:00:10Z | t1 | |
| 2021-01-01T00:00:20Z | 7 | t1 |
| 2021-01-01T00:00:30Z | t1 | |
| 2021-01-01T00:00:40Z | t1 | |
| 2021-01-01T00:00:50Z | 4 | t1 |
| _time | _value | *tag |
|---|---|---|
| 2021-01-01T00:00:00Z | t2 | |
| 2021-01-01T00:00:10Z | 4 | t2 |
| 2021-01-01T00:00:20Z | -3 | t2 |
| 2021-01-01T00:00:30Z | 19 | t2 |
| 2021-01-01T00:00:40Z | t2 | |
| 2021-01-01T00:00:50Z | 1 | t2 |
| _time | _value | *tag |
|---|---|---|
| 2021-01-01T00:00:00Z | -2 | t1 |
| 2021-01-01T00:00:10Z | -2 | t1 |
| 2021-01-01T00:00:20Z | 7 | t1 |
| 2021-01-01T00:00:30Z | 7 | t1 |
| 2021-01-01T00:00:40Z | 7 | t1 |
| 2021-01-01T00:00:50Z | 4 | t1 |
| _time | _value | *tag |
|---|---|---|
| 2021-01-01T00:00:00Z | t2 | |
| 2021-01-01T00:00:10Z | 4 | t2 |
| 2021-01-01T00:00:20Z | -3 | t2 |
| 2021-01-01T00:00:30Z | 19 | t2 |
| 2021-01-01T00:00:40Z | 19 | t2 |
| 2021-01-01T00:00:50Z | 1 | t2 |
{{% /expand %}} {{< /expand-wrapper >}}