Look up the encoded index of a value.
Lists and arrays are converted to tuples before the lookup.
- Parameters:
v (Any) – The value to look up.
stats (Dict[str, int]) – A mapping from category values to encoded indices.
- Returns:
The index that stats maps v to, or -1 if v is missing from
stats or is unhashable.