Login using Social Account
     Continue with GoogleLogin using your credentials
If you have a multi-dimensional Numpy array, say, a 3-D, 2-D, etc. array, you can convert it to a 1-dimensional (1-D) array using Numpy function ravel()
.
You may need to do this, as some of the libraries need the data to be fed in 1-dimensional form.
Please follow the below steps:
(1) Import numpy as np
(2) Please create a 2-dimensional Numpy array (of size 4x5) called my_2d_arr
as below
my_2d_arr = np.arange(20).reshape(<<your code comes here>>)
(3) Call ravel()
function on the above Numpy array (my_2d_arr
) to create a 1-dimensional array, and store this 1-D array in a variable called my_1d_arr
<<your code comes here>> = my_2d_arr.ravel()
(4) Print this my_1d_arr
array by using print()
function to see its value
print(<<your code comes here>>)
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
No hints are availble for this assesment
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...