content/flux/v0/stdlib/interpolate/linear.md
interpolate.linear() inserts rows at regular intervals using linear interpolation to
determine values for inserted rows.
_time and _value columns._time and _value must be part of the group key.(<-tables: stream[{A with _value: float, _time: time}], every: duration) => stream[{A with _value: float, _time: time}]
{{% caption %}} For more information, see Function type signatures. {{% /caption %}}
({{< req >}}) Duration of time between interpolated points.
Input data. Default is piped-forward data (<-).
import "interpolate"
data
|> interpolate.linear(every: 1d)
{{< expand-wrapper >}} {{% expand "View example input and output" %}}
| _time | _value |
|---|---|
| 2021-01-01T00:00:00Z | 10 |
| 2021-01-02T00:00:00Z | 20 |
| 2021-01-04T00:00:00Z | 40 |
| 2021-01-05T00:00:00Z | 50 |
| 2021-01-08T00:00:00Z | 80 |
| 2021-01-09T00:00:00Z | 90 |
| _time | _value |
|---|---|
| 2021-01-01T00:00:00Z | 10 |
| 2021-01-02T00:00:00Z | 20 |
| 2021-01-03T00:00:00Z | 30 |
| 2021-01-04T00:00:00Z | 40 |
| 2021-01-05T00:00:00Z | 50 |
| 2021-01-06T00:00:00Z | 60 |
| 2021-01-07T00:00:00Z | 70 |
| 2021-01-08T00:00:00Z | 80 |
| 2021-01-09T00:00:00Z | 90 |
{{% /expand %}} {{< /expand-wrapper >}}