1

I'm trying to reshape an array of bitmap images that has a shape of (50,50,90000). How can I modify it so that I can get an array of (90000,50,50)? - I tried array.reshape(90000,50,50), or np.reshape(array, (90000,50,50), order='C' /'F'), but these options changed the order of the data so I couldn't get the images after using these.

2
  • 1
    arr.transpose(2,0,1)? Please name the example arrays. Commented May 13, 2022 at 22:57
  • Yep, it worked! The other code in the comment also worked. Thank you! Commented May 13, 2022 at 23:02

1 Answer 1

1

Try np.moveaxis, e.g. like so:

np.moveaxis(arr, 0, 2)

There's also np.swapaxes if that suits your needs better.

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.