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

reject for filters

Remove the given columns or rows from the table. Opposite of `select`.

Signature

> reject {flags} ...rest

Flags

  • --ignore-errors, -i: ignore missing data (make all cell path members optional)

Parameters

  • ...rest: The names of columns to remove from the table.

Input/output types:

inputoutput
list<any>list<any>
recordrecord
tabletable

Examples

Reject a column in the ls table

> ls | reject modified

Reject a column in a table

> [[a, b]; [1, 2]] | reject a
╭───┬───╮
│ # │ b │
├───┼───┤
│ 0 │ 2 │
╰───┴───╯

Reject a row in a table

> [[a, b]; [1, 2] [3, 4]] | reject 1
╭───┬───┬───╮
│ # │ a │ b │
├───┼───┼───┤
│ 0 │ 1 │ 2 │
╰───┴───┴───╯

Reject the specified field in a record

> {a: 1, b: 2} | reject a
╭───┬───╮
│ b │ 2 │
╰───┴───╯

Reject a nested field in a record

> {a: {b: 3, c: 5}} | reject a.b
╭───┬───────────╮
│   │ ╭───┬───╮ │
│ a │ │ c │ 5 │ │
│   │ ╰───┴───╯ │
╰───┴───────────╯

Reject multiple rows

> [[name type size]; [Cargo.toml toml 1kb] [Cargo.lock toml 2kb] [file.json json 3kb]] | reject 0 2

Reject multiple columns

> [[name type size]; [Cargo.toml toml 1kb] [Cargo.lock toml 2kb]] | reject type size
╭───┬────────────╮
│ # │    name    │
├───┼────────────┤
│ 0 │ Cargo.toml │
│ 1 │ Cargo.lock │
╰───┴────────────╯

Reject multiple columns by spreading a list

> let cols = [type size]; [[name type size]; [Cargo.toml toml 1kb] [Cargo.lock toml 2kb]] | reject ...$cols
╭───┬────────────╮
│ # │    name    │
├───┼────────────┤
│ 0 │ Cargo.toml │
│ 1 │ Cargo.lock │
╰───┴────────────╯

Reject item in list

> [1 2 3] | reject 1
╭───┬───╮
│ 0 │ 1 │
│ 1 │ 3 │
╰───┴───╯

Notes

To remove a quantity of rows or columns, use skip, drop, or drop column.