Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Scripting_function


Panel
titleDescription

Given a sequence of values, returns the 'mode', or most frequent values.

Returns an empty list if the sequence was empty or None.

Client permissions restrictions


Panel
titleSyntax

system.math.mode(values)

  • Parameters

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 values 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

Panel
titleCode Example
Code Block
languagepy
titleCode Snippet - 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
Panel
titleKeywords

system math mode, math.mode