Indexing
The examples on this page use the following DataFrame:
df
Access a cell by index
df.age[1]
df[1].age
df["age"][1]
df[1]["age"]
Row indices
indices() returns the indices of all rows of the DataFrame as an IntRange — from 0 to the number of rows minus one:
df.indices() // 0..9
Pass a row condition to get only the indices of the rows that satisfy it, as a List<Int> in row order:
val moscow = df.indices { city == "Moscow" } // [2, 6]
val moscow = df.indices { "city"<String?>() == "Moscow" } // [2, 6]
Use the result to slice those rows out of the dataframe:
df.getRows(df.indices { city == "Moscow" })
See also rowsCount, which returns how many rows there are rather than their indices, and filter, which returns the matching rows themselves.
29 September 2026