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

DataFrame Help

Slice rows

API reference: take, drop

Returns a DataFrame with rows at given indices:

df
df[0, 3, 4]

Returns a DataFrame with rows inside given index ranges (including boundary indices):

df[1..2]
df[0..2, 4..5]

take

Returns a DataFrame containing the first n rows.

df.take(5)

If called on a DataColumn, returns a DataColumn containing its first n values.

df.age.take(5)

takeLast

Returns a DataFrame containing the last n rows.

df.takeLast(5)

If called on a DataColumn, returns a DataColumn containing its last n values.

df.age.takeLast(5)

takeWhile

Returns a DataFrame containing the first rows that satisfy the given condition.

df.takeWhile { isHappy }

drop

Returns a DataFrame containing all rows except the first n rows.

df.drop(5)

If called on a DataColumn, returns a DataColumn containing all values of this DataColumn except the first n values.

df.age.drop(5)

dropLast

Returns a DataFrame containing all rows except the last n rows.

df.dropLast() // default 1
df.dropLast(5)

If called on a DataColumn, returns a DataColumn containing all values of this DataColumn except the last n values.

df.age.dropLast(5)

dropWhile

Returns a DataFrame containing all rows except the first rows that satisfy the given condition.

df.dropWhile { isHappy }
02 November 2026