Qu

drop_row

Builtin index · Collections & strings

result = drop_row(t, i) or drop_row(t, [i, j])

Input: t, i · Output: result

What it is

t is a Table; i/j are numbers (0-based row positions), or a Vec of them.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = drop_row(t, i) or drop_row(t, [i, j])
t Tablet is a Table.
i number or Veci/j are numbers (0-based row positions), or a Vec of them.
result Table
Returns a Table without those rows, by position.

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

v = [10, 20, 30, 40, 50]
v[0] = 99
print("v = {v}")

M = [1,2;3,4]
M[0,1] = 77
print("M = {M}")

df = table(x=[1,2,3,4], y=[10,20,30,40])
@df.drop_row(1)
print(df)
output
v = [99, 20, 30, 40, 50]
M = [1, 77; 3, 4]
x   y
-  --
1  10
3  30
4  40

from tour

How it works

drop_row(t, i) / drop_row(t, [i, j, ...]) (§ table row index, 2026-08-26; multi-row 2026-08-27) — a new Table with row i (or every row named in the list) removed. Kept as a distinct name from column-drop above rather than an overload of it: drop(t, 2) would be genuinely ambiguous between "drop the column named 2" (column names are arbitrary strings — drop already stringifies its arguments via column_names_arg/display_value) and "drop row 2"; two distinct names sidestep that ambiguity entirely, matching insert_row/insert_column's own distinct-names split below. The "which row(s)" argument accepts a single index (drop_row(t, 2)) or a list of indices — either a bracketed numeric Vec literal (drop_row(t, [1, 3]), the natural spelling since row positions are numbers, unlike column drop's string-only tuple form) or a parenthesized tuple (drop_row(t, (1, 3))) — via row_indices_arg below.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.