Documentation

Fill null values in data

Use fill() to replace null values with:

data
    |> fill(usePrevious: true)

// OR

data
    |> fill(value: 0.0)

Fill empty windows of time

The fill() function does not fill empty windows of time. It only replaces null values in existing data. Filling empty windows of time requires time interpolation (see influxdata/flux#2428).

Fill with the previous value

To fill null values with the previous non-null value, set the usePrevious parameter to true.

Values remain null if there is no previous non-null value in the table.

data
    |> fill(usePrevious: true)

Given the following input:

_time_value
2020-01-01T00:01:00Znull
2020-01-01T00:02:00Z0.8
2020-01-01T00:03:00Znull
2020-01-01T00:04:00Znull
2020-01-01T00:05:00Z1.4

fill(usePrevious: true) returns:

_time_value
2020-01-01T00:01:00Znull
2020-01-01T00:02:00Z0.8
2020-01-01T00:03:00Z0.8
2020-01-01T00:04:00Z0.8
2020-01-01T00:05:00Z1.4

Fill with a specified value

To fill null values with a specified value, use the value parameter to specify the fill value. The fill value must match the data type of the column.

data
    |> fill(value: 0.0)

Given the following input:

_time_value
2020-01-01T00:01:00Znull
2020-01-01T00:02:00Z0.8
2020-01-01T00:03:00Znull
2020-01-01T00:04:00Znull
2020-01-01T00:05:00Z1.4

fill(value: 0.0) returns:

_time_value
2020-01-01T00:01:00Z0.0
2020-01-01T00:02:00Z0.8
2020-01-01T00:03:00Z0.0
2020-01-01T00:04:00Z0.0
2020-01-01T00:05:00Z1.4

Was this page helpful?

Thank you for your feedback!


The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Read more

InfluxDB v3 enhancements and InfluxDB Clustered is now generally available

New capabilities, including faster query performance and management tooling advance the InfluxDB v3 product line. InfluxDB Clustered is now generally available.

InfluxDB v3 performance and features

The InfluxDB v3 product line has seen significant enhancements in query performance and has made new management tooling available. These enhancements include an operational dashboard to monitor the health of your InfluxDB cluster, single sign-on (SSO) support in InfluxDB Cloud Dedicated, and new management APIs for tokens and databases.

Learn about the new v3 enhancements


InfluxDB Clustered general availability

InfluxDB Clustered is now generally available and gives you the power of InfluxDB v3 in your self-managed stack.

Talk to us about InfluxDB Clustered