AI engineering glossary · NumPy pandas visualization

What is reshape?

Reshape: Changing the shape of an array without changing its data, for example turning a flat list of 12 values into a 3 by 4 grid. The total number of elements must stay the same, and one dimension may be given as -1 to let NumPy work it out.

Level: beginnerTopic: NumPy pandas visualization

Reshape: an example

np.arange(12).reshape(3, 4) makes a 3 by 4 array; reshape(-1, 2) would make 6 rows of 2.

Related terms

More NumPy pandas visualization terms

Where you learn it

Reshape is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.