array = numpy.array([1,2,3,4,5,6,7,8,9,10])
array[-1:3:1]
>> []
我希望这个数组索引返回这样的东西:
[10,1,2,3]
最佳答案
使用np.roll
到:
Roll array elements along a given axis. Elements that roll beyond the last position are re-introduced at the first.
>>> np.roll(x, 1)[:4]
array([10, 1, 2, 3])
关于python - 从头到尾的 Numpy 切片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50880157/