Divooka Reference

Column Operations

12 nodes

On this page 12

Add Column

Function

The table with a column added at the end - or put in place of the column of that name, ignoring letter case.

Signature
AddColumn(table: Table, name: Text, column: Column) -> Table
Table AddColumn(Table table, string name, Column column)

Parameters

nametypedefaultdescription
tableTable—The table.
nameText—The new column's name.
columnColumn—The column, as long as the table.

Returns

TableTable
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Column Operations
Package
Data Analytics

Change Type

Function

The table with columns converted to another kind - Number, Text, Truth or Date & Time. Values that do not convert become empty, and Failures counts them.

Signature
ChangeType -> (result: Table, failures: Integer)
    table: Table
    columns: Text Array
    type: ColumnType
    dateFormat: Text
Table ChangeType(
    Table table,
    string[] columns,
    ColumnType type,
    string dateFormat,
    out int failures)

Parameters

nametypedefaultdescription
tableTable—The table.
columnsText Array—The columns to convert.
typeColumnType—The kind to convert them to.
dateFormatText—For dates, a format to read them by exactly, such as dd/MM/yyyy; empty to recognise the usual forms.

Returns

TableTable
failuresInteger

Remarks

Converting is forgiving: numbers lose their currency signs, percent signs and spaces ("$1,200" is 1200), truths accept yes/no, y/n, on/off and 1/0, and dates accept ISO dates, month-first dates and spelled-out months - or exactly the Date Format given, such as dd/MM/yyyy.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Column Operations
Package
Data Analytics

Drop Columns

Function

Every column but these.

Signature
DropColumns(table: Table, columns: Text Array) -> Table
Table DropColumns(Table table, string[] columns)

Parameters

nametypedefaultdescription
tableTable—The table.
columnsText Array—The columns to drop.

Returns

TableTable
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Column Operations
Package
Data Analytics

Fill Empty Cells

Function

The table with its empty cells filled: with a value, with zero, from the nearest value above or below, with the column's mean or median, or along a straight line between the values on either side.

Signature
FillEmptyCells -> Table
    table: Table
    columns: Text Array
    strategy: Fill Strategy
    value: Text
Table FillEmptyCells(
    Table table,
    string[] columns,
    FillStrategy strategy = FillStrategy.Value,
    string value = "")

Parameters

nametypedefaultdescription
tableTable—The table.
columnsText Array—The columns to fill; every column when empty.
strategyFill StrategyValueWhat to fill with.
valueText—The value, when filling with a value; read as the column's kind.

Returns

TableTable
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Column Operations
Package
Data Analytics

Formula Column

Function

A column computed from a formula over each row - Units * [Unit Price], IF(Revenue > 1000, "large", "small"), YEAR(Date) - added at the end, or put in place of the column of that name.

Signature
FormulaColumn -> Table
    table: Table
    name: Text
    formula: Text
    x: Any
    y: Any
Table FormulaColumn(
    Table table,
    string name = "Result",
    string formula = "",
    object x,
    object y)

Parameters

nametypedefaultdescription
tableTable—The table.
nameTextResultThe new column's name.
formulaText—The formula.
xAny—A value the formula can use as $x.
yAny—A value the formula can use as $y.

Returns

TableTable
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Column Operations
Package
Data Analytics

Get Column

Function

One column of a table, to work on by itself.

Signature
GetColumn(table: Table, column: Text) -> Column
Column GetColumn(Table table, string column)

Parameters

nametypedefaultdescription
tableTable—The table.
columnText—The column's name.

Returns

ColumnColumn
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Column Operations
Package
Data Analytics

Rename Columns

Function

The table with columns renamed: each of From becomes the To in the same position.

Signature
RenameColumns -> Table
    table: Table
    from: Text Array
    to: Text Array
Table RenameColumns(Table table, string[] from, string[] to)

Parameters

nametypedefaultdescription
tableTable—The table.
fromText Array—The current names.
toText Array—The new names, in the same order.

Returns

TableTable
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Column Operations
Package
Data Analytics

Rolling Calculation

Function

A column calculated over a moving window of rows: each row gets the mean, sum, minimum, maximum, median, standard deviation, variance or count of the Window rows ending at it - for the whole table or within each group.

Signature
RollingCalculation -> Table
    table: Table
    column: Text
    window: Integer
    operation: Rolling Operation
    minimumValues: Integer
    groupBy: Text
    name: Text
Table RollingCalculation(
    Table table,
    string column,
    int window = 7,
    RollingOperation operation = RollingOperation.Mean,
    int minimumValues = 0,
    string groupBy = "",
    string name = "")

Parameters

nametypedefaultdescription
tableTable—The table, in the order the window should move.
columnText—The column of numbers.
windowInteger7How many rows the window holds.
operationRolling OperationMeanWhat to calculate over each window.
minimumValuesInteger0How many values a window needs to give a result; 0 for a whole window.
groupByText—A column to move the window within each value of, separately; empty for the whole table.
nameText—The new column's name; "7-row mean of Sales" and the like when empty.

Returns

TableTable

Remarks

A row whose window holds fewer values than Minimum Values (the whole window when 0) is empty - so a 7-day average starts on the seventh day.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Column Operations
Package
Data Analytics

Running Calculation

Function

A column calculated down another, row after row: a running total, average, maximum or minimum, the difference or percent change from the previous row, each row's share of the total, its rank, or its row number - for the whole table or within each group.

Signature
RunningCalculation -> Table
    table: Table
    operation: Running Operation
    column: Text
    groupBy: Text
    name: Text
Table RunningCalculation(
    Table table,
    RunningOperation operation = RunningOperation.RunningSum,
    string column = "",
    string groupBy = "",
    string name = "")

Parameters

nametypedefaultdescription
tableTable—The table, in the order the calculation should run.
operationRunning OperationRunning sumWhat to calculate.
columnText—The column of numbers to calculate down; not needed for Row Number.
groupByText—A column to calculate within each value of, separately; empty for the whole table.
nameText—The new column's name; "Running total of Revenue" and the like when empty.

Returns

TableTable

Remarks

An empty value gives an empty result in its own row, and the calculation carries on past it. Ranks put the largest value first.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Column Operations
Package
Data Analytics

Select Columns

Function

Only these columns, in this order.

Signature
SelectColumns(table: Table, columns: Text Array) -> Table
Table SelectColumns(Table table, string[] columns)

Parameters

nametypedefaultdescription
tableTable—The table.
columnsText Array—The columns to keep, in the order wanted.

Returns

TableTable
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Column Operations
Package
Data Analytics

Shift Column

Function

A column of another column's values moved down by Periods rows - each row gets the value from that many rows before it, or after it when Periods is negative - for the whole table or within each group.

Signature
ShiftColumn -> Table
    table: Table
    column: Text
    periods: Integer
    groupBy: Text
    name: Text
Table ShiftColumn(
    Table table,
    string column,
    int periods = 1,
    string groupBy = "",
    string name = "")

Parameters

nametypedefaultdescription
tableTable—The table, in the order to shift along.
columnText—The column to shift; any kind.
periodsInteger1How many rows to move down; negative moves up.
groupByText—A column to shift within each value of, separately; empty for the whole table.
nameText—The new column's name; "Previous Revenue" and the like when empty.

Returns

TableTable
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Column Operations
Package
Data Analytics

Split Column

Function

A column of text split into several at a delimiter: "Ada Lovelace" split at a space into Name 1 and Name 2. The last part keeps whatever text remains.

Signature
SplitColumn -> Table
    table: Table
    column: Text
    delimiter: Text
    parts: Integer
    keepOriginal: Truth
Table SplitColumn(
    Table table,
    string column,
    string delimiter = ",",
    int parts = 2,
    bool keepOriginal = false)

Parameters

nametypedefaultdescription
tableTable—The table.
columnText—The column to split.
delimiterText,What to split at.
partsInteger2How many columns to make, from 1 to 50.
keepOriginalTruthFalseWhether to keep the original column beside the parts.

Returns

TableTable
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Column Operations
Package
Data Analytics