If there's a clear name for it, I'd be happy to refactor some utilities relating to this indexation or vocabulary construct (mapping from objects to contiguous integers from 0 to n_objects - 1). The operations that commonly happen are: create a dict that autoincrements; map that dict to an equivalent array/list; map back the other direction. I'm not sure if these would benefit from being abstracted behind functions.

Yet, for that second function, for example, we have used:
```python
l = sorted(d, key=d.__getitem__)
```
or similar to convert to a list, but the following is faster (linear complexity; faster benchmark):
```python
l = np.array(lenI(d), dtype=object)
keys, vals = zip(*six.iteritems(d))
l[vals] = keys
```
so putting it behind a named function might make sense.