How to convert real numpy array to int numpy array? Tried using map directly to array but it did not work.
Use the
|
|||||
|
Some numpy functions for how to control the rounding: rint, floor,trunc, ceil. depending how u wish to round the floats, up, down, or to the nearest int.
To make one of this in to int, or one of the other types in numpy, astype (as answered by BrenBern):
|
|||||||||
|
you can use
|
|||
|
If you're not sure your input is going to be a Numpy array, you can use
If the input array already has the correct dtype,
|
|||
|