8000
ENH: Add casting option to
8000
astype
that would raise in case of overflow
#25396
Proposed new feature or change:
Calling
astype
on an ndarray with values that will overflow under the new dtype currently succeeds and the values do overflow.Do you think we could add a new casting option to
astype
that would check values for overflow? Something like the following (the exact option name and the resulting behavior - excpetion vs warning, etc. - is of course open to discussion):This is already done for operations on scalars, but not on arrays, which I assume is due to the performance bottleneck it'd create, if we'd have to check integer overflow by hand. The same does not apply to
astype
though, since only the users that would be willing to sacrifice performance for checks would do so.Thoughts?
The text was updated successfully, but these errors were encountered: