Answers for "np array to float"

1

np float to int

int_array = float_array.astype(int)
Posted by: Guest on December-23-2020
0

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)
Posted by: Guest on April-24-2022
0

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)
Posted by: Guest on April-24-2022

Python Answers by Framework

Browse Popular Code Answers by Language