Can any one please to tell me how to round float to integer ? I tried with np.round() on pred_y, I get dot zero like 12.0 for example and not 12 without dot zero, in python
Thank you for your helping
Can any one please to tell me how to round float to integer ? I tried with np.round() on pred_y, I get dot zero like 12.0 for example and not 12 without dot zero, in python
Thank you for your helping
Use int(), Like this:
>>int(2.4)
2
>>int(4.0)
4
If you are dealing with numpy
array you can do the following
y = np.array(np.round(x), dtype=int)
However if its just a number int(round(x))
will do the job.
for convert float to int you just have to use int() function.
Example:
Int(128.2)
128