[Numpy-discussion] efficient way to do this?

John Hunter jdh2358@gmail....
Mon Sep 22 10:18:19 CDT 2008


On Mon, Sep 22, 2008 at 10:13 AM, Robert Kern <robert.kern@gmail.com> wrote:

> marked[ind + np.arange(Nmark)] = True

That triggers a broadcasting error:

Traceback (most recent call last):
  File "/home/titan/johnh/test.py", line 13, in ?
    marked3[ind + np.arange(Nmark)] = True
ValueError: shape mismatch: objects cannot be broadcast to a single shape

I am hoping there is some clever way to do this with broadcasting, I
am just not that clever...

JDH


More information about the Numpy-discussion mailing list