ReorderDocs

internal interface ReorderDocs

Reorders the selected columns of the DataFrame.

This function does not reorder the columns immediately. It returns a Reorder, which serves as an intermediate step. First, cast can optionally change the type of the selected columns for the column expression. Then finish it with one of these methods to get a new DataFrame:

  • by — puts the selected columns in ascending order of the value of a column expression;

  • byDesc — puts them in descending order of that value;

  • byName — puts them in lexicographic order of their names.

The selected columns change places only with each other: they take the positions of the selected columns, in the new order. Other columns stay where they are. The values in the columns do not change.

If the selected columns belong to different column groups, they are reordered within their groups, so no column moves to another group.

If exactly one column group is selected, its nested columns are reordered instead. A column group selected together with other columns moves as a whole, and its nested columns keep their order.

Columns for which the expression gives equal results keep their original order.

Check out Grammar.

This can include column groups and nested columns.

See Selecting Columns.

For more information: See reorder on the documentation website.

See also reorderColumnsBy and reorderColumnsByName, which reorder all columns of the DataFrame, and move, which moves columns to a new place.

Don't confuse it with sortBy, which changes the order of rows, not columns.

Types

Link copied to clipboard
typealias Grammar = Nothing
Link copied to clipboard

Selecting columns for various DataFrame operations can be done in the following ways: