The following code:
x = list(range(0,10))
random.shuffle(x)
ind = np.argsort(x)
x[ind]
produces the error: TypeError: only integer scalar arrays can be converted to a scalar index
Note that my problem is different than in the question, "numpy array TypeError: only integer scalar arrays can be converted to a scalar index", which is attempting something more complex.
My mistake in this question is that I'm trying to use a list of indexes on an ordinary python list -- see my answer. I expect it happens much more broadly than just with using range and shuffle.
np.arange(0,10)instead oflist(range(0,10))xwhich is[0,1,2,3,4,5,6,7,8,9]. Do you agree?range(200)[np.array((119,), dtype=int)], wherenp.array((119,), dtype=int)is short forindex = np.where(some_complicated_thing == some_complicated_other_thing)This worked in py2.7 and in older versions of numpy, as long as the conversion to an integer index was legal. You might be doing this for old habits reasons too.