How to convert real numpy array to int numpy array? Tried using map directly to array but it did not work.
Join the Stack Overflow Community
Stack Overflow is a community of 7.0 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up
Join them; it only takes a minute:
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):
|
|||||||||
|
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,
|
|||
|
you can use
|
|||
|