GatherDocs
Reshapes the DataFrame by gathering specified columns into two columns: keys and values (or into just one of them).
By default, the "key" column contains the names of the gathered columns, and the "value" column holds the corresponding cell values. The original columns selected for gathering are removed from the result, while all other columns remain unchanged — except that their values are duplicated for each generated key-value pair.
This function does not perform the reshaping immediately — it returns a Gather object, which serves as an intermediate step. Before applying the final transformation, you may:
explode list-columns (
explodeLists);cast the value type (
cast).
Finally, reshape the DataFrame using one of the following methods:
Each of these methods returns a new reshaped DataFrame.
This operation is the reverse of pivot.
This can include column groups and nested columns.
For more information: See gather on the documentation website.
See Grammar.