Python | Numpy matrix.reshape() Read Courses Practice Improve Improve Improve Like Article Like Save Article Save Report issue Report With the help of Numpy matrix.reshape() method, we are able to reshape the shape of the given matrix. Remember all elements should be covered after reshaping the given matrix. Syntax : matrix.reshape(shape) Return: new reshaped matrix Example #1 : In the given example we are able to reshape the given matrix by using matrix.reshape() method. # import the important module in python import numpy as np # make matrix with numpy gfg = np.matrix('[64, 1; 12, 3]') # applying matrix.reshape() method geeks = gfg.reshape((1, 4)) print(geeks) Output: [[64 1 12 3]] Example #2 : # import the important module in python import numpy as np # make a matrix with numpy gfg = np.matrix('[1, 2; 4, 5; 7, 8]') # applying matrix.reshape() method geeks = gfg.reshape((2, 3)) print(geeks) Output: [[1 2 4] [5 7 8]] Don't miss your chance to ride the wave of the data revolution! Every industry is scaling new heights by tapping into the power of data. Sharpen your skills and become a part of the hottest trend in the 21st century. Dive into the future of technology - explore the Complete Machine Learning and Data Science Program by GeeksforGeeks and stay ahead of the curve. Last Updated : 17 Feb, 2023 Like Article Save Article Previous Python | Numpy matrix.resize() Next NumPy Array Shape Share your thoughts in the comments Add Your Comment Please Login to comment...