Q:

Write a NumPy program to convert specified inputs to arrays with at least one dimension

0

Write a NumPy program to convert specified inputs to arrays with at least one dimension.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import numpy as np
x= 12.0
print(np.atleast_1d(x))
x = np.arange(6.0).reshape(2, 3)
print(np.atleast_1d(x))
print(np.atleast_1d(1, [3, 4]))

Sample Output:

[ 12.]                                                                 
[[ 0.  1.  2.]                                                         
 [ 3.  4.  5.]]                                                        
[array([1]), array([3, 4])]

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now