📜  使用 numpy 从数组中返回奇数行和偶数列的数组 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:13.451000             🧑  作者: Mango

代码示例1
import numpy

sampleArray = numpy.array([[3 ,6, 9, 12], [15 ,18, 21, 24], 
[27 ,30, 33, 36], [39 ,42, 45, 48], [51 ,54, 57, 60]]) 
print("Printing Input Array")
print(sampleArray)

print("\n Printing array of odd rows and even columns")
newArray = sampleArray[::2, 1::2]
print(newArray)