[Numpy-discussion] efficient way to do this?

John Hunter jdh2358 at gmail.com
Mon Sep 22 11:18:19 EDT 2008


On Mon, Sep 22, 2008 at 10:13 AM, Robert Kern <robert.kern at 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