DataFrame 1.0 Help

Slice rows

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 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 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 first rows that satisfy the given condition

df.takeWhile { isHappy }

drop

Returns a DataFrame containing all rows except 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 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 first rows that satisfy the given condition

df.dropWhile { isHappy }
09 September 2026