Machine Learning Prerequisites


#1

NumPy - Arrays - Reshaping an Array

point 16
Answer not submitting even run properly
import numpy as np
my_first_arr = np.array([ [1,2,3,4,5,6,7,8] ])
my_new_arr = my_first_arr.reshape(2,4)
print(my_new_arr)
print(my_first_arr)

error coming
my_first_arr array not created with proper values


#2

Hi, Hina.

Your efforts are good!
But what about the part2? for second array?
You did not tried the below for 3 columns and unknown rows?

import numpy as np
my_second_arr=np.array([0,1,2,3,4,5,6,7,8])
my_updated_arr=my_second_arr.reshape(-1,3)
print(my_second_arr)

You should be able to do it. Please try to read Instructions correctly.
All the best!