drop for filters
Remove items/rows from the end of the input list/table, or remove bytes from the end of binary data. Counterpart of `skip`. Opposite of `last`. For binary input, `rows` can also be specified as a filesize.
Command Type
built-in
Signature
> drop {flags} (rows)
Parameters
rows: The number of items to remove.
Input/output types:
| input | output |
|---|---|
| table | table |
| list<any> | list<any> |
| binary | binary |
Examples
Remove the last item of a list
> [0,1,2,3] | drop
╭───┬───╮
│ 0 │ 0 │
│ 1 │ 1 │
│ 2 │ 2 │
╰───┴───╯Remove zero item of a list
> [0,1,2,3] | drop 0
╭───┬───╮
│ 0 │ 0 │
│ 1 │ 1 │
│ 2 │ 2 │
│ 3 │ 3 │
╰───┴───╯Remove the last two items of a list
> [0,1,2,3] | drop 2
╭───┬───╮
│ 0 │ 0 │
│ 1 │ 1 │
╰───┴───╯Remove the last row in a table
> [[a, b]; [1, 2] [3, 4]] | drop 1
╭───┬───┬───╮
│ # │ a │ b │
├───┼───┼───┤
│ 0 │ 1 │ 2 │
╰───┴───┴───╯Remove the last 2 bytes of a binary value, using a filesize argument
> 0x[01 23 45] | drop 2b
Length: 1 (0x1) bytes | null_char printable whitespace ascii_other non_ascii
00000000: 01 •Subcommands:
| name | description | type |
|---|---|---|
drop column | Remove N columns at the right-hand end of the input table. To remove columns by name, use reject. | built-in |
drop nth | Drop the selected rows. | built-in |