以下代码:
x = list(range(0,10))
random.shuffle(x)
ind = np.argsort(x)
x[ind]
产生错误:TypeError:只有整数标量数组才能转换为标量索引
请注意,我的问题与问题不同, “numpy array TypeError: only integer scalar arrays can be converted to a scalar index”,这是在尝试更复杂的东西。
我在这个问题上的错误是,我试图在一个普通的python列表上使用一个索引列表——请看我的答案。我希望它发生的范围远不止使用range和shuffle。
目前没有回答
相关问题 更多 >
编程相关推荐