User 4234 | 3/31/2016, 12:55:35 PM
For example, I have a list [a,b,c], and a SArray, the elements of which are [a,a,b,b,c,c,a].
I want to create another SArray, by replacing the elements of original by their index in the list.
For the above example, the desired final result is [0,0,1,1,2,2,0]
One way I came up with is [List.index(s) for s in SArray], but it turns out to be slow.
Any faster or more convenient way?