np float to int
int_array = float_array.astype(int)
np float to int
int_array = float_array.astype(int)
Python NumPy asfarray Function Example List to float type array
# welcome to softhunt.net
# Python program explaining
# numpy.asfarray() function
import numpy as np
my_list = [1, 2, 3, 4, 5, 6]
print ("Input list : ", my_list)
out_arr = np.asfarray(my_list)
print ("output float type array from input list : \n", out_arr)
Python NumPy asfarray Function Example Scalar to float type array
# welcome to softhunt.net
# Python program explaining
# numpy.asfarray() function
import numpy as np
my_scalar = 50
print ("Input scalar : ", my_scalar)
out_arr = np.asfarray(my_scalar, dtype ='float')
print ("output float type array from input scalar : ", out_arr)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us