1

I have a N x M sized numpy array named my_array.

I want to down sample the array and eliminate rows 1,3,5,7... and columns 1,3,5,7...

I can eliminate the rows using my_array[::2]

I can eliminate the columns in a for loop. Is there a way to eliminate the columns using slicing?

1 Answer 1

1

Using slicing this can be done with the following syntax:

my_array[::2 , ::2]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.