experimental.mode() function
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.
Function type: Aggregate
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
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()
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for InfluxDB and this documentation. To find support, the following resources are available:
InfluxDB Cloud and InfluxDB Enterprise customers can contact InfluxData Support.