I have to arrays, one contain weights, and the other contain the categories (e.g w=[3, 4, 1, 2],x= ["a","b","c","c"]). Now, I'd like to sort the array x using the array of weights. How can one do this with the least amount of code? Is there a way of sorting an array and obtaining the corresponding indexes, so you can use this new sorted order in any other array with the same size?
I know that one can do this using DataFrames, but I'm looking for a way of doing this without resorting to that.