Is your feature request related to a problem?
PR #3368 creates an inverse index array of unsorted indices with this Python loop:
mask = np.zeros_like(self.ix)
for i, x in enumerate(indices):
values = np.where(self.ix == x)[0]
mask[values] = i
self._unique_restore_mask = mask
Describe the solution you'd like
This could be done very easily and much faster in Cython instead, in the lib module.
Describe alternatives you've considered
Additional context