indices

Returns the indices of all rows in this DataFrame, from 0 to the number of rows minus one, or an empty range if this DataFrame has no rows.

For more information: See indices on the documentation website.

See also:

  • rowsCount — returns the number of rows in this DataFrame.

  • getRows — returns the rows at the given indices, as a new DataFrame.

  • filter — returns the rows that satisfy a condition, instead of their indices.

Return

An IntRange with the index of every row in this DataFrame.


inline fun <T> DataFrame<T>.indices(filter: RowFilter<T>): List<Int>

Returns the indices of the rows in this DataFrame that satisfy the given filter.

They are listed in the same order as the rows in this DataFrame.

The filter is a RowFilter — a lambda that receives each DataRow as both this and it and is expected to return a Boolean value.

It allows you to define conditions using the row's values directly, including through extension properties for convenient and type-safe access.

For more information: See indices on the documentation website. See RowFilter on the documentation website.

See also:

  • rowsCount — returns the number of rows in this DataFrame.

  • getRows — returns the rows at the given indices, as a new DataFrame.

  • filter — returns the rows that satisfy a condition, instead of their indices.

Example

// The indices of the rows where the "city" column is "Moscow"
df.indices { city == "Moscow" }

Return

A List with the index of every row that satisfies the filter, empty if no row satisfies it.

Parameters

filter

A RowFilter that returns true for the rows whose indices should be returned.