---
title: interpolate.linear() function
description: interpolate.linear() inserts rows at regular intervals using linear interpolation to determine values for inserted rows.
url: https://docs.influxdata.com/flux/v0/stdlib/interpolate/linear/
estimated_tokens: 535
product: Flux
version: v0
publisher: InfluxData
canonical: https://docs.influxdata.com/flux/v0/stdlib/interpolate/linear/
date: '2024-04-08T16:01:02-06:00'
lastmod: '2024-04-08T16:01:02-06:00'
---

* Flux 0.87.0+

InfluxDB support

`interpolate.linear()` inserts rows at regular intervals using linear interpolation to
determine values for inserted rows.

### Function requirements

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

##### Function type signature

```js
(<-tables: stream[{A with _value: float, _time: time}], every: duration) => stream[{A with _value: float, _time: time}]
```

For more information, see [Function type signatures](/flux/v0/function-type-signatures/).

## Parameters

### every

(Required)
Duration of time between interpolated points.

### tables

Input data. Default is piped-forward data (`<-`).

## Examples

### Interpolate missing data by day

```js
import "interpolate"

data
    |> interpolate.linear(every: 1d)
```

[](#view-example-input-and-output)

View example input and output

#### Input data

|       \_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   |

#### Output data

|       \_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   |

[transformations](/flux/v0/tags/transformations/)
| _time | _value |
| --- | --- |
| _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 |
| --- | --- |
| _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 |
