single
Returns the single value in this DataColumn.
For more information: See single on the documentation website.
None of the neighbouring operations require the DataColumn to contain exactly one value: first and last return the first or the last value, firstOrNull returns the first value, or null if the DataColumn is empty, and take and takeLast return several values as a new DataColumn. There is no singleOrNull for a DataColumn.
Return
The single value in this DataColumn. It can be null if the DataColumn contains exactly one value and that value is null.
Throws
if the DataColumn is empty.
if the DataColumn contains more than one value.
Returns the single row in this DataFrame.
For more information: See single on the documentation website.
See also singleOrNull, that returns null instead of throwing, and first, last, that return the first or the last row and do not require the DataFrame to contain exactly one row.
Return
Throws
Returns the single row in this DataFrame that satisfies the given predicate.
The predicate 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 RowFilter on the documentation website.
This can include column groups and nested columns.
Example
// In a DataFrame of financial transactions,
// find the only transaction made with the given id
df.single { id == 137 }For more information: See single on the documentation website.
See also singleOrNull, that returns null instead of throwing, and first, last, that return the first or the last matching row and do not require the DataFrame to contain exactly one matching row.
Return
A DataRow containing the single row that matches the given predicate.
Parameters
A row filter used to get the single row that satisfies a condition specified in this filter.