Median

library operator
ID: db72519d-c9f5-487b-962c-e6eb3068962e
Emits the median number of a stream of numbers.

Behavior

Test data showing the behavior of Median

Integers

It returns the integer for which the half of input values is greater and the other half is smaller.

Input Output
[1,2,3,4] 2
[1,12,9,4,4,26,7,35,1,2... 9
Empty

It emits null for empty streams.

Input Output
[] null
Floats

It behaves accordingly for floats.

Input Output
[1.5,3.5,2.5] 2.5

Implementation

The implementation of Median makes use of the following 4 operators.

1
Evaluates an expression.
1
Selects the n-th item in a stream of generic items, n being the index.
1
Counts number of items in a stream of generic items.
1
Sorts a stream of primitive items.

Used in

The Median operator is used by 1 operators.

Emits the z-score for each number of a stream of numbers.