[SciPy-user] addressing 1d array
Sun May 17 19:56:21 CDT 2009
You could take a look at numpy.atleast_1d.
On Mon, May 18, 2009 at 8:52 AM, Ross Williamson
> Hi everyone
> I'm currently writing some code where I read in a data file - Generally
> there are > 1 entry and I check certain parameters for example
> if data['date'] == something:
> Which is fine until I get a single element and the above gives:
> '0-d arrays cannot be indexed'
> which makes sense , however, is there any easy way of just using the
> above code without having to check each time to see if it is only a
> single element - i.e. transparent (similar to idl) and just assumes that
> data is the only element if there is only one in there.
> SciPy-user mailing list
More information about the SciPy-user