79477305

Date: 2025-03-01 08:50:48
Score: 0.5
Natty:
Report link

You use dict for this.

a1 = np.array([1, 2, 3, 4])
a2 = np.array([2, 1, 33, 4])

old_indices = {element: index for index, element in enumerate(a1.to_list())}
result = [old_indices.get(i, -1) for element in a2.to_list()]
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Hanstjua