Write a NumPy program to convert specified inputs to arrays with at least one dimension.
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])]
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer