[SciPy-user] Results of squeeze function on a [1,1] size array

Michael Hearne mhearne@usgs....
Mon Oct 13 12:12:00 CDT 2008

Using numpy version 1.1.0.dev5077
Using scipy version 0.7.0.dev4174

on Mac OS X

If I do the following:
x = zeros([1,1])
x[0] = 3.4756
y = squeeze(x)

What is y?  When I print or do arithmetic with y, it seems like it's a 
scalar.   However, the type() function seems to indicate that it's a  
numpy.ndarray,  but with 0 dimensionality.

How do I detect when I'm in this state?
How can I convert this from a (sort of) scalar into an array with length 
of one?


Michael Hearne
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.

More information about the SciPy-user mailing list