collection_utils Module

Utilities for working with collections.

@author: drusk

pml.utils.collection_utils.are_all_equal(iterable)[source]

Checks if all elements of a collection are equal.

Args:
iterable: iterator
A collection of values such as a list.
Returns:
equal: boolean
True if all elements of iterable are equal. Will also return true if iterable is empty.
pml.utils.collection_utils.get_key_with_highest_value(dictionary)[source]

Retrieves the key with the highest value from a dictionary.

Args:
dictionary: dict
The dictionary whose keys and values are being examined.
Returns:
key:
The key with the highest value. Returns None if the dictionary is empty.
pml.utils.collection_utils.get_most_common(iterable)[source]

Finds the item which occurs most often in a collection of values.

Args:
iterable: iterator
The items which will be searched to find the most common.
Returns:
most_common:
The most common item in the collection. Ties are broken arbitrarily.

Project Versions

Previous topic

clustering Module

Next topic

decision_trees Module

This Page