llms.txt: machine-readable documentation index. Markdown version of this page is also available.

DataFrame Help

first

Returns the first value in this DataColumn. If the DataColumn is empty, throws an exception.

API reference: first

df
df.name.first() // returns "Alice"

If a predicate is specified, returns the first value in this DataColumn that matches the predicate. Throws an exception if the DataColumn contains no elements matching the predicate.

df.age.first { it > 17 } // returns 20

firstOrNull

Returns the first value in this DataColumn. If the DataColumn is empty, returns null.

df .filter { age > 50 } // df is empty after filtering .age .firstOrNull() // returns null
df .filter { "age"<Int>() > 50 } // df is empty after filtering .age .firstOrNull() // returns null

If a predicate is specified, returns the first value in this DataColumn that matches the predicate, or null if the DataColumn contains no elements matching the predicate.

df.age.firstOrNull { it > 50 } // returns null
02 November 2026