Documentation

experimental.mode() function

Flux 0.107.0+

The experimental.mode() function is subject to change at any time. By using this function, you accept the risks of experimental functions.

The experimental.mode() function computes the mode or value that occurs most often in the _value column in each input table. experimental.mode() is an aggregate function.

import "experimental"

experimental.mode()

If there are multiple modes, it returns all of them in a sorted table. Mode only considers non-null values. If there is no mode, experimental.mode() returns null.

Empty tables

experimental.mode() drops empty tables.

Supported data types
  • String
  • Float
  • Integer
  • UInteger
  • Boolean
  • Time

Parameters

tables

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

Examples

Return the mode of windowed data
import "experimental"

from(bucket: "example-bucket")
  |> filter(fn: (r) =>
    r._measurement == "example-measurement" and
    r._field == "example-field"
  )
  |> range(start:-12h)
  |> window(every:10m)
  |> experimental.mode()

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.