---
title: cov() function
description: cov() computes the covariance between two streams of tables.
url: https://docs.influxdata.com/flux/v0/stdlib/universe/cov/
estimated_tokens: 1810
product: Flux
version: v0
---

# cov() function

-   Flux 0.7.0+
-   View InfluxDB support

`cov()` computes the covariance between two streams of tables.

##### Function type signature

```js
(on: [string], x: A, y: B, ?pearsonr: bool) => stream[C] where C: Record
```

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

## Parameters

### x

(Required) First input stream.

### y

(Required) Second input stream.

### on

(Required) List of columns to join on.

### pearsonr

Normalize results to the Pearson R coefficient. Default is `false`.

## Examples

### Return the covariance between two streams of tables

```js
import "generate"

stream1 =
    generate.from(
        count: 5,
        fn: (n) => n * n,
        start: 2021-01-01T00:00:00Z,
        stop: 2021-01-01T00:01:00Z,
    )
        |> toFloat()

stream2 =
    generate.from(
        count: 5,
        fn: (n) => n * n * n / 2,
        start: 2021-01-01T00:00:00Z,
        stop: 2021-01-01T00:01:00Z,
    )
        |> toFloat()

cov(x: stream1, y: stream2, on: ["_time"])
```

[](#view-example-output)

View example output

#### Output data

| _value |
| --- |
| 87.75 |

#### Related

-   [covariance() function](/flux/v0/stdlib/universe/covariance/)

[transformations](/flux/v0/tags/transformations/) [aggregates](/flux/v0/tags/aggregates/)
