Feature request: Add a non-circular shift function that is similar to [`numpy.roll`](https://numpy.org/doc/stable/reference/generated/numpy.roll.html) but, instead of wrapping elements around, replaces unoccupied entries with a specified fill value. Examples:
``` >>> import numpy as np >>> a = np.arange(1, 6) >>> a array([1, 2, 3, 4, 5]) >>> np.shifted(a, 2) array([0, 0, 1, 2, 3]) >>> np.shifted(a, -2) array([3, 4, 5, 0, 0]) >>> a = np.arange(1, 10).reshape((3, 3)) >>> a array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) >>> np.shifted(a, (1, -2), (0, 1)) array([[0, 0, 0], [3, 0, 0], [6, 0, 0]]) ``` Prior discussion: https://github.com/numpy/numpy/issues/26220 Pull request: https://github.com/numpy/numpy/pull/29389 _______________________________________________ NumPy-Discussion mailing list -- numpy-discussion@python.org To unsubscribe send an email to numpy-discussion-le...@python.org https://mail.python.org/mailman3//lists/numpy-discussion.python.org Member address: arch...@mail-archive.com