mapValues

fun <T, C, K, R> Gather<T, C, K, *>.mapValues(transform: (C) -> R): Gather<T, C, K, R>

Applies transform to the values from the columns previously selected by gather.

This is an intermediate step; returns a new Gather with transformed values.

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.
// Assuming `resultA` and `resultB` contain `Double` values,
// `mapValues` transforms each value using the provided expression.
df.gather { resultA and resultB }
.mapValues { (it + 0.5).toFloat() }
.into("series", "value")

Return

A new Gather instance with transformed values.