Documentation

interpolate.linear() function

The interpolate.linear function inserts rows at regular intervals using linear interpolation to determine values for inserted rows.

import "interpolate"

interpolate.linear(every: 1m)

Function requirements

  • Input data must have _time and _value columns.
  • All columns other than _time and _value must be part of the group key.

Parameters

every

Duration of time between interpolated points.

Data type: Duration

Examples

Interpolate missing data by day

import "interpolate"

data
  |> interpolate.linear(every: 1d)
Input
_time_value
2021-01-01T00:00:00Z10.0
2021-01-02T00:00:00Z20.0
2021-01-04T00:00:00Z40.0
2021-01-05T00:00:00Z50.0
2021-01-08T00:00:00Z80.0
2021-01-09T00:00:00Z90.0
Output
_time_value
2021-01-01T00:00:00Z10.0
2021-01-02T00:00:00Z20.0
2021-01-04T00:00:00Z40.0
2021-01-05T00:00:00Z50.0
2021-01-06T00:00:00Z60.0
2021-01-07T00:00:00Z70.0
2021-01-08T00:00:00Z80.0
2021-01-09T00:00:00Z90.0

Select your region

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.