Answers for "np as float"

3

np.random.float

numpy.random.uniform(low=0.0, high=1.0, size=None)
Posted by: Guest on May-17-2020
1

np convert to int

>>> x = np.array([[1.0, 2.3], [1.3, 2.9]])
>>> x
array([[ 1. ,  2.3],
       [ 1.3,  2.9]])
>>> x.astype(int)
array([[1, 2],
       [1, 2]])
Posted by: Guest on October-17-2020
1

np float to int

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

Python Answers by Framework

Browse Popular Code Answers by Language