system.math.median
This function is used in Python Scripting.
Description​
Takes a sequence of values, and returns the median. The median represents the middle value in a set of data.
Returns NaN (Not a Number) if passed an empty sequence.
Client Permission Restrictions​
This scripting function has no Client Permission restrictions.
Syntax​
system.math.median(values)
Parameters​
Type | Parameter | Description |
---|---|---|
List[Float] | values | A sequence of numerical values. Accepts both integers and floats. The sequence may not contain None type values. However, passing a None type object instead of a sequence of numerical values will return NaN. |
Returns​
Float - The median, or NaN if the input was empty or null.
Scope​
Gateway, Vision Client, Perspective Session
Code Examples​
Example #1 - Calculating Median
# Create a list of values.
values = [3.5, 5.6, 7.8, 7.4, 3.8]
# Prints the resulting value.
print system.math.median(values)