math max

For math.

Returns the maximum of a list of values, or of columns in a table.

Command Type

built-in

Signature

> math max {flags} ...rest

Parameters

  • ...rest: The cell-paths/columns to operate on.

Input/output types:

input output
list<number> number
list<duration> duration
list<filesize> filesize
list<any> any
range number
table record
record record

Examples

Find the maximum of a list of numbers.

> [-50 100 25] | math max
100

Find the maxima of the columns of a table.

> [{a: 1 b: 3} {a: 2 b: -1}] | math max
╭───┬───╮
│ a │ 2 │
│ b │ 3 │
╰───┴───╯

Find the maximum of a list of dates.

> [2022-02-02 2022-12-30 2012-12-12] | math max
Fri, 30 Dec 2022 00:00:00 +0000 (3 years ago)

Find the maximum of list-valued columns in a record.

> {alice: [1 5 3], bob: [4 5 6]} | math max
╭───────┬───╮
│ alice │ 5 │
│ bob   │ 6 │
╰───────┴───╯

Find the maximum of a single column using a cell path.

> {alice: [1 5 3], bob: [4 5 6]} | math max alice
╭───────┬───────────╮
│ alice │ 5         │
│       │ ╭───┬───╮ │
│ bob   │ │ 0 │ 4 │ │
│       │ │ 1 │ 5 │ │
│       │ │ 2 │ 6 │ │
│       │ ╰───┴───╯ │
╰───────┴───────────╯

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.