1.9 KiB
1.9 KiB
title | description | aliases | menu | weight | flux/v0.x/tags | related | introduced | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mode() function | The `mode()` function computes the mode or value that occurs most often in a specified column in the input table. |
|
|
102 |
|
|
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
.
{{% warn %}}
Empty tables
mode()
drops empty tables.
{{% /warn %}}
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
{{% flux/sample-example-intro %}}
import "sampledata"
sampledata.int()
|> mode()
{{% expand "View input and output" %}} {{< flex >}} {{% flex-content %}}
Input data
{{% flux/sample "int" %}}
{{% /flex-content %}} {{% flex-content %}}
Output data
tag | _value |
---|---|
t1 |
tag | _value |
---|---|
t2 | 19 |
{{% /flex-content %}} {{< /flex >}} {{% /expand %}}