Course Hive
Search

Welcome

Sign in or create your account

Continue with Google
or
Learn to reshape NumPy arrays in 4 minutes! ↔️
Play lesson

NumPy tutorial for beginners 🔢 - Learn to reshape NumPy arrays in 4 minutes! ↔️

5.0 (0)
5 learners

What you'll learn

This course includes

  • 1.3 hours of video
  • Certificate of completion
  • Access on mobile and TV

Summary

Keywords

Full Transcript

#python #coding #numpy # reshape() = Changes the shape of an array # w/o altering its underlying data # array.reshape(rows, columns) import numpy as np array = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) array = array.reshape(2, 6) array = array.reshape(3, 4) # array = array.reshape(4, 4) # Too many elements # array = array.reshape(2, 4) # Too few elements array = array.reshape(4, 3) array = array.reshape(2, 2, 3) # 3D array = array.reshape(3, 2, 2) # 3D # -1 NumPy will automatically infer the correct size for that dimension array = array.reshape(1, -1) array = array.reshape(-1, 1) print(array)

Course Hive

Continue this lesson in the app

Install CourseHive on Android or iOS to keep learning while you move.

Related Courses

FAQs

Course Hive
Download CourseHive
Keep learning anywhere