(array, dtype=None)
return convert_to_dict(array, values, dtype)
Remap an array to a constant 0-n range.

    For example, the values (0, 1, 1.1, 1.5, 50, 50.002, 1054)
    will be remapped to (0, 1, 2, 3, 4, 5, 6).
Remap an array to a constant 0-n range.
Remap an array to a constant 0 - n range .
def remap_to_range(array, dtype=None):
    """Remap an array to a constant 0-n range.

    For example, the values (0, 1, 1.1, 1.5, 50, 50.002, 1054)
    will be remapped to (0, 1, 2, 3, 4, 5, 6).
    """
    values = {v: i for i, v in enumerate(sorted(set(array.ravel())))}
    return convert_to_dict(array, values, dtype)
def remap_to_range ( array , dtype = None ) : values = { v : i for i , v in enumerate ( sorted ( set ( array . ravel ( ) ) ) ) } return convert_to_dict ( array , values , dtype )