juniorNumPy

What is reshape in NumPy?

Updated May 17, 2026

Short answer

reshape changes array dimensions without altering data.

Deep explanation

It returns a new view when possible, reorganizing memory layout logically.

Real-world example

Reshaping data for neural network input layers.

Common mistakes

  • Using incompatible shapes.

Follow-up questions

  • What is -1 in reshape?
  • Does reshape copy data?

More NumPy interview questions

View all →