takeLast

fun <T> DataColumn<T>.takeLast(n: Int = 1): DataColumn<T>

Returns a DataColumn containing the last n values of this DataColumn.

If n is zero or negative, an empty DataColumn is returned.

For more information: See takeLast on the documentation website.

See also:

  • take — takes the first n values instead.

  • dropLast — drops the last n values.

  • drop(n: Int) — drops the first n values.

  • drop{ predicate: Predicate<T> } — drops every value that matches the predicate.

Return

A DataColumn containing the last n values of this DataColumn, or an empty DataColumn if n is zero or negative.

Parameters

n

The number of values to take. Must not exceed the size of this DataColumn.

Throws

if n is greater than the size of this DataColumn.


fun <T> DataFrame<T>.takeLast(n: Int = 1): DataFrame<T>

Returns a DataFrame containing the last n rows.

If n is greater than or equal to the number of rows, the whole DataFrame is returned.

For more information: See takeLast on the documentation website.

See also:

  • take — takes the first n rows instead.

  • takeWhile — takes the first rows while the predicate holds.

  • dropLast — drops the last n rows.

  • filter — keeps every row that matches the predicate.

Return

A DataFrame containing the last n rows, or the whole DataFrame if n is greater than or equal to the number of rows.

Parameters

n

The number of rows to take. Must not be negative.

Throws