Skip to main content

Table.running

runningstatisticofasset_modegroup_byorder_byon_problems

Group: Values
Aliases: count, cumulative, maximum, mean, minimum, product, standard deviation, sum, sum, total, variance

Documentation

Adds a new column to the table with a running calculation.

Arguments

  • statistic: The running statistic to calculate.
  • of: The existing column to run the statistic over.
  • as: The name of the new column.
  • set_mode: Specifies the expected behaviour in regards to existing column with the same name.
  • group_by: Specifies the columns to group by. The running statistic is calculated 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 running statistic is calculated according to the specified ordering.

Errors

  • If the columns specified in group_by or order_by are not present in the table, a Missing_Input_Columns error is raised.
  • If the column with the same name as provided by as already exists, a Duplicate_Output_Column_Names problem is reported and the existing column is renamed to avoid the clash.
  • If grouping on floating point numbers, a Floating_Point_Equality problem 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 running statistic is calculated for each row, but the order of the rows itself is not changed by this operation.