Documentation

mode() function

Flux 0.36.0+

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

mode(column: "_value")

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, mode() returns null.

Empty tables

mode() drops empty tables.

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

Parameters

column

The column to use to compute the mode. Default is "_value".

tables

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

Examples

The following example uses data provided by the sampledata package to show how mode() transforms data.

import "sampledata"

sampledata.int()
  |> mode()

View input and output


Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.