structuretoolkit.common.helper.get_average_of_unique_labels

structuretoolkit.common.helper.get_average_of_unique_labels#

structuretoolkit.common.helper.get_average_of_unique_labels(labels: ndarray, values: ndarray) ndarray[source]#

This function returns the average values of those elements, which share the same labels

Example:

>>> labels = [0, 1, 0, 2]
>>> values = [0, 1, 2, 3]
>>> print(get_average_of_unique_labels(labels, values))
array([1, 1, 3])