Higher-Order Functions#

accumulate

The accumulate template applies func to init and X for accumulating iteration (i.e. the result of an iteration is passed forward to the next).

aggrTopN

After sorting funcArgs based on sortingCol, aggrTopN applies func to the first top elements in funcArgs.

all

Return 0 if at least one element of X is false or 0; return 1 otherwise.

any

Return 1 if there is at least one element in X that is true or not 0.

byColumn

If func is a unary function, apply the specified function to each column of X; if func is a binary function, apply func(Xi, Yi) to each column of X and Y.

byRow

If func is a unary function, apply the specified function to each row of X; if func is a binary function, apply func(Xi, Yi) to each row of X and Y.

call

Call a function with the specified parameters.

contextby

Calculate func(funcArgs) for each groupingCol group.

cross

Apply func to the permutation of all individual elements of X and Y and return a matrix.

pcross

pcross is the parallel computing version of template function cross.

each

Apply a function (specified by func or operator) to each element of args / X / Y.

eachLeft

Calculate func(X(i),Y) for each element of X.

eachPre

Apply func over all pairs of consecutive elements of X.

eachRight

Calculate func(X, Y(i)) for each element of Y.

eachPost

Apply func over all pairs of consecutive elements of the object.

groupby

For each group, calculate func(funcArgs) and return a scalar/vector/dictionary.

loop

The loop template is very similar to the each template.

ploop

ploop is the parallel computing version of template function loop .

moving

Apply the function/operator to a moving window of the given objects.

nullCompare

Return a Boolean value which is the result of func(X,Y).

pivot

Rearrange the results of an aggregate function as a matrix.

pcall

Conduct parallel computing of a vector function.

reduce

The function of reduce is the same as accumulate.

rolling

The rolling function applies func to a moving window of funcArgs.

segmentby

segmentby is very similar to contextby except for how groups are determined.

talib

Regarding null value handling, the differences between DolphinDB's built-in moving functions and Python TA-lib lie in:

tmoving

Apply the function/operator to a sliding window of the given objects.

twindow

Apply func over a sliding window of funcArgs.

window

Apply func over a sliding window of funcArgs.

withNullFill

If only 1 of the elements at the same location of x and y is null, replace the null value with fillValue in the calculation.

unifiedCall

Call a function with the specified parameters.

rowGroupby

Group the data by groupingCol, then calculate func(funcArgs) and return a scalar for each group.