So for example I have:
a = np.array(...)
a[idx / 3] = 5
idx / 3
will be a float
, even though it will always have an integer value in that program. This will raise either a VisibleDeprecationWarning
or is already no longer supported by newer Python versions.
Is there a built-in function that converts a float to an int and can raise an Exception if the input value is not an integer? Or what is the proper way to do it?
I'm aware that this might also lead to some questions about 'how close' to an integer, that's why I ask and do not just trust in floor
/ceil
.