get_index

threadcount.fit.get_index(array, value)[source]

Determine the index of ‘array’ which is closest to value.

Parameters:
  • array (float or array/list/iterable of floats) – The list of numbers to search. Will be processed with np.array(array).

  • value (float or array/list/iterable of floats) – The value(s) to search for in array

Returns:

The index (or indices) of array where the value is closest to the search value.

Return type:

int or list of ints

Examples

>>> get_index([10,11,12,13,14],[13,22])
[3, 4]
>>> get_index(4,[3,0])
[0, 0]
>>> get_index([4,0],10)
0