Write a NumPy program to convert an array to a float type
import numpy as np import numpy as np a = [1, 2, 3, 4] print("Original array") print(a) x = np.asfarray(a) print("Array converted to a float type:") print(x)
Sample Output:
Original array [1, 2, 3, 4] Array converted to a float type: [ 1. 2. 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