[Numpy-discussion] Re: How do I use numpy to do this?

Robert Kern robert.kern at gmail.com
Thu Jun 1 13:14:06 EDT 2006


Charlie Moad wrote:
> Here's my crack at it.
> 
> pts = mgrid[minx:maxx,miny:maxy].transpose()
> pts.reshape(pts.size/2, 2)
> #pts is good to go

Well, if we're going for terseness:

points = mgrid[minx:maxx, miny:maxy].reshape(2, -1).transpose()

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco





More information about the NumPy-Discussion mailing list