Qu

index

Builtin index · Collections & strings

result = index(t, "col")

Input: t, "col" · Output: result

What it is

t is a Table; "col" is a Str column name.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = index(t, "col")
t Tablet is a Table.
"col" Str"col" is a Str column name.
result Table
Returns a Table: t with its row index set to that column, so rows can afterwards be looked up by label.

Examples

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

df = DataFrame(id=[1, 2, 3], name=["alu", "steel", "brass"])
print(at(df, 1))                              # {id = 2, name = "steel"}

labeled = index(df, "name")
print(labeled)
grown = insert_row(df, 3, {id=4, name="glass"})
print(grown)
output
{id = 2, name = "steel"}
id  name 
--  -----
 1  alu  
 2  steel
 3  brass
id  name 
--  -----
 1  alu  
 2  steel
 3  brass
 4  glass

from collections-strings

How it works

index by "col" / t.index("col") (ยง table row index, 2026-08-26) โ€” designates col as the row lookup key for t[key] from now on (numeric or string, whatever the column holds). t.index() with ZERO arguments resets back to the default auto index โ€” the agreed workaround for "no .index(null)", since Qu has no null/nothing literal to spell that with. Returns a NEW table either way, matching every other Table operation's immutable/functional convention (select/drop/filter/...).

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