mapKeys
inline fun <T, C, reified K, R> Gather<T, C, *, R>.mapKeys(noinline transform: (String) -> K): Gather<T, C, K, R>
Applies transform to the gathering keys — that is, the names of the columns previously selected by gather.
This is an intermediate step; returns a new Gather with transformed keys.
For more information, see: See gather on the documentation website.
See also: Grammar.
Example
// Gather `resultA` and `resultB` columns into a single "value" column,
// with the "series" column containing a key derived from the last letter
// of each original column name (i.e., 'A' or 'B').
df.gather { resultA and resultB }
.mapKeys { it.last() }
.into("series", "value")Content copied to clipboard
Return
A new Gather instance with transformed keys.