[Numpy-discussion] dimension independent copy of corner of array

Robert Kern robert.kern at gmail.com
Mon Jul 13 07:38:37 EDT 2015


newarr[tuple(slice(0, i) for i in oldarray.shape)] = oldarray

On Mon, Jul 13, 2015 at 12:34 PM, Neal Becker <ndbecker2 at gmail.com> wrote:

> I want to copy an array to the corner of a new array.  What is a dimension
> independent way to say:
>
> newarr[:i0,:i1,...] = oldarray
>
> where (i0,i1...) is oldarray.shape?
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>



-- 
Robert Kern
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20150713/7278e350/attachment.html>


More information about the NumPy-Discussion mailing list