[Numpy-discussion] yet another trivial question

Nathaniel Smith njs at pobox.com
Fri Nov 2 15:54:33 EDT 2012


On Fri, Nov 2, 2012 at 2:18 PM, Neal Becker <ndbecker2 at gmail.com> wrote:
> I'm trying to convert some matlab code.  I see this:
>
> b(1)=[];
>
> AFAICT, this removes the first element of the array, shifting the others.
>
> What is the preferred numpy equivalent?

Perhaps np.delete is what you're looking for. (Esp. if you have
multiple items to remove like this, or want to remove something
besides the first element in the array.)

-n



More information about the NumPy-Discussion mailing list