move_columns

The move_columns method creates a new table with specified columns moved to a specific column index value.

Syntax

Parameters

ParameterTypeDescription
idxint

Column index where the specified columns will be moved in the new table. The index is zero-based, so column index number 2 would be the third column.

colsUnion[str, Sequence[str]]

Columns to be moved.

Returns

A new table with specified columns moved to a specific column index value.

Examples

The following example moves column C to the second position (1st index) in the new table.

The following example moves columns B and C to the second position (1st index) and third position in the new table.