3.6 - Shape and Reshape
Enroll to start learning
You’ve not yet enrolled in this course. Please enroll for free to listen to audio lessons, classroom podcasts and take practice test.
Practice Questions
Test your understanding with targeted questions
What does the shape attribute of a NumPy array indicate?
💡 Hint: Think about structure!
How do you access the shape of a NumPy array named 'data'?
💡 Hint: What do we add after the variable?
4 more questions available
Interactive Quizzes
Quick quizzes to reinforce your learning
What does the .shape attribute return?
💡 Hint: Consider what tells you the arrangement of data.
True or False: Reshaping an array changes the data within it.
💡 Hint: Think about what reshape does.
1 more question available
Challenge Problems
Push your limits with advanced challenges
You have an array of shape (6,) containing numbers 1 to 6. How can you reshape it to a 2x3 array? Write the code and describe the output shape.
💡 Hint: How many total elements do you have to work with?
Given a 3D array with shape (2, 3, 4), how would you reshape it to a 4D array? Discuss any challenges with dimension compatibility.
💡 Hint: What do you need to remember about the number of elements when reshaping?
Get performance evaluation
Reference links
Supplementary resources to enhance your learning experience.