system.math.mode
This function is used in Python Scripting.
Descriptionβ
Given a sequence of values, returns the 'mode', or most frequent values.
Returns an empty list if the sequence was empty or None.
Client Permission Restrictionsβ
This scripting function has no Client Permission restrictions.
Syntaxβ
system.math.mode(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. |
Returnsβ
List[Float] - A Java Array (functionally similar to a Python List) of floats representing the most frequent value(s) in the values parameter. If the values parameter was empty, then an empty list will be returned instead.
Scopeβ
Gateway, Vision Client, Perspective Session
Code Examplesβ
Example #1 - Getting the Mode from a List of Values
# Create a list of values.
values = [3.5, 5.6, 7.8, 7.4, 7.8]
# Return the most common values.
modes = system.math.mode(values)
# Print the first item in the result.
print modes[0]
# Iterate over the results.
for number in modes:
print number