Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Return array of odd rows and even columns from array using numpy

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("
 Printing array of odd rows and even columns")
newArray = sampleArray[::2, 1::2]
print(newArray)
Source by pynative.com #
 
PREVIOUS NEXT
Tagged: #Return #array #odd #rows #columns #array #numpy
ADD COMMENT
Topic
Name
3+2 =