[SciPy-user] problem referencing single element arrays

Robert Kern robert.kern at gmail.com
Wed Apr 30 22:39:53 EDT 2008


On Wed, Apr 30, 2008 at 9:11 PM, Alan Jackson <alan at ajackson.org> wrote:
> Having a problem with numpy that has me stumped.
>
>  I have a large set of arrays. I want to set up cross reference lists of
>  elements within those arrays, with the lists just being pointers to the objects
>  (floating point numbers) stored in the arrays.
>
>  The problem is that some arrays have only a single element, so when I try to
>  store a[0] for a single element array, I get an error, "0-d arrays can't be
>  indexed". How do I get a pointer to the object stored and not the array for
>  single element arrays?

a[()]

>  Or maybe I don't want to be doing this?

Quite possibly. Can you expand on your use case?

-- 
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 SciPy-User mailing list