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

drop nth for filters

Drop the selected rows.

Signature

> drop nth {flags} (row number or row range) ...rest

Parameters

  • row number or row range: The number of the row to drop or a range to drop consecutive rows.
  • ...rest: The number of the row to drop.

Input/output types:

inputoutput
list<any>list<any>
rangelist<number>

Examples

Drop the first, second, and third row

> [sam,sarah,2,3,4,5] | drop nth 0 1 2
╭───┬───╮
│ 0 │ 3 │
│ 1 │ 4 │
│ 2 │ 5 │
╰───┴───╯

Drop the first, second, and third row

> [0,1,2,3,4,5] | drop nth 0 1 2
╭───┬───╮
│ 0 │ 3 │
│ 1 │ 4 │
│ 2 │ 5 │
╰───┴───╯

Drop rows 0 2 4

> [0,1,2,3,4,5] | drop nth 0 2 4
╭───┬───╮
│ 0 │ 1 │
│ 1 │ 3 │
│ 2 │ 5 │
╰───┴───╯

Drop rows 2 0 4

> [0,1,2,3,4,5] | drop nth 2 0 4
╭───┬───╮
│ 0 │ 1 │
│ 1 │ 3 │
│ 2 │ 5 │
╰───┴───╯

Drop range rows from second to fourth

> [first second third fourth fifth] | drop nth (1..3)
╭───┬───────╮
│ 0 │ first │
│ 1 │ fifth │
╰───┴───────╯

Drop all rows except first row

> [0,1,2,3,4,5] | drop nth 1..
╭───┬───╮
│ 0 │ 0 │
╰───┴───╯

Drop rows 3,4,5

> [0,1,2,3,4,5] | drop nth 3..
╭───┬───╮
│ 0 │ 0 │
│ 1 │ 1 │
│ 2 │ 2 │
╰───┴───╯