docs-v2/content/flux/v0.x/stdlib/experimental/mean.md

47 lines
1.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
title: experimental.mean() function
description: >
The `experimental.mean()` function computes the mean or average of non-null
values in the `_value` column of each input table.
menu:
flux_0_x_ref:
name: experimental.mean
parent: experimental
weight: 302
aliases:
- /influxdb/v2.0/reference/flux/experimental/mean
- /influxdb/cloud/reference/flux/experimental/mean
related:
- /flux/v0.x/stdlib/universe/mean
- /{{< latest "influxdb" "v1" >}}/query_language/functions/#mean, InfluxQL MEAN()
flux/v0.x/tags: [transformations, aggregates]
introduced: 0.107.0
---
The `experimental.mean()` function computes the mean or average of non-null
values in the `_value` column of each input table.
Output tables contain a single row the with the calculated mean in the `_value` column.
_`experimental.mean()` is an [aggregate function](/flux/v0.x/function-types/#aggregates)._
```js
import "experimental"
experimental.mean()
```
## Parameters
### tables {data-type="stream of tables"}
Input data.
Default is piped-forward data (`<-`).
## Examples
```js
import "experimental"
from(bucket: "example-bucket")
|> filter(fn: (r) => r._measurement == "example-measurement" and r._field == "example-field")
|> range(start: -1h)
|> experimental.mean()
```