Table.add_row_number
add_row_numbernamefromstepgroup_byorder_byon_problems
Group: Values
Aliases: add index column, rank, record id
Documentation
Adds a new column to the table enumerating the rows.
Arguments
name: The name of the new column. Defaults to "Row".from: The starting value for the enumeration. Defaults to 0.step: The amount to increment the enumeration by. Defaults to 1.group_by: Specifies the columns to group by. The row numbers are counted separately for each group. By default, all rows are treated as a single group.order_by: Specifies the columns to order by. Defaults to the order of the rows in the table. The row numbers are assigned according to the specified ordering.
Errors
- If the columns specified in
group_byororder_byare not present in the table, aMissing_Input_Columnserror is raised. - If the column with the same name as provided
namealready exists, aDuplicate_Output_Column_Namesproblem is reported and the existing column is renamed to avoid the clash. - If grouping on floating point numbers, a
Floating_Point_Equalityproblem is reported.
Remarks
Ordering of rows
Note that the ordering of rows from the original table is preserved in all cases. The grouping and ordering settings affect how the row numbers are assigned to each row, but the order of the rows itself is not changed by this operation.