Rounds arr inplace if destination dtype is integer. Parameters ---------- arr : ndarray Input array. dtype : dtype The dtype of the destination array.
(arr, dtype)
| 16 | |
| 17 | |
| 18 | def _round_if_needed(arr, dtype): |
| 19 | """ |
| 20 | Rounds arr inplace if destination dtype is integer. |
| 21 | |
| 22 | Parameters |
| 23 | ---------- |
| 24 | arr : ndarray |
| 25 | Input array. |
| 26 | dtype : dtype |
| 27 | The dtype of the destination array. |
| 28 | """ |
| 29 | if np.issubdtype(dtype, np.integer): |
| 30 | arr.round(out=arr) |
| 31 | |
| 32 | |
| 33 | def _slice_at_axis(sl, axis): |