[Numpy-discussion] efficient way to do this?

John Hunter jdh2358@gmail....
Mon Sep 22 10:25:15 CDT 2008


On Mon, Sep 22, 2008 at 10:23 AM, Robert Kern <robert.kern@gmail.com> wrote:
> On Mon, Sep 22, 2008 at 10:22, Robert Kern <robert.kern@gmail.com> wrote:
>
>> ind2mark = np.asarray((ind[:,np.newaxis] + np.arange(Nmark).flat).clip(0, N-1)
>> marked[ind2mark] = True
>
> Missing parenthesis:
>
> ind2mark = np.asarray((ind[:,np.newaxis] + np.arange(Nmark)).flat).clip(0, N-1)

Excellent, thanks!  Note to self, must become a newaxis guru...

JDH


More information about the Numpy-discussion mailing list