Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
  • 한국어
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
  • 한국어
GitHub
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Env
    • Experimental
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Removed
    • Shells
    • Strings
    • System
    • Viewers

math max for math

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

Signature

> math max {flags} ...rest

Parameters

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

Input/output types:

inputoutput
list<number>number
list<duration>duration
list<filesize>filesize
list<any>any
rangenumber
tablerecord
recordrecord

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 │ │
│       │ ╰───┴───╯ │
╰───────┴───────────╯