Question: PYTHON. I have an array of shape (2500001,1). I want to change the shape so that it is (5,2500001). How do I write the code

PYTHON. I have an array of shape (2500001,1). I want to change the shape so that it is (5,2500001). How do I write the code for this? I tried this method and it did not work. I get an error (ValueError: cannot reshape array of size 2500001 into shape (5,2500001))

import numpy as np

# Assuming your original array is named "original_array"

original_array = np.arange(2500001).reshape((2500001, 1))

# Reshape the array to (5,2500001)

new_array = np.reshape(original_array, (5, 2500001))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!