get_index_by_brackets#

get_index_by_brackets(brackets)[source]#

Create a dictionary mapping each item in the value arrays to the key. For example, if brackets are age brackets, then this function will map each age to the age bracket or bin that it belongs to, so that the resulting dictionary will give index_by_brackets[age_index] = age bracket of age_index.

Parameters:

brackets (dict) – A dictionary mapping bracket or bin keys to the array of values that belong to each bracket.

Returns:

A dictionary mapping indices to the brackets or bins each index belongs to.

Return type:

dict