Python random sample of two arrays, but matching indices
Using the numpy.random.randint function, you generate a list of random numbers, meaning that you can select certain datapoints twice.
I have two numpy arrays x and y, which have length 10,000.
I would like to plot a random subset of 1,000 entries of both x and y.
Is there an easy way to use the lovely, compact random.sample(population, k) on both x and y to select the same corresponding indices? (The y and x vectors are linked by a function y(x) say.)
Thanks.