[SciPy-user] problem referencing single element arrays

Alan Jackson alan at ajackson.org
Wed Apr 30 22:11:52 EDT 2008


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? 

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

-- 
-----------------------------------------------------------------------
| Alan K. Jackson            | To see a World in a Grain of Sand      |
| alan at ajackson.org          | And a Heaven in a Wild Flower,         |
| www.ajackson.org           | Hold Infinity in the palm of your hand |
| Houston, Texas             | And Eternity in an hour. - Blake       |
-----------------------------------------------------------------------



More information about the SciPy-User mailing list