[SciPy-user] object_arrtype addition error

Chris Fonnesbeck fonnesbeck at gmail.com
Tue Nov 29 11:38:41 CST 2005


On 11/29/05, Chris Fonnesbeck <fonnesbeck at gmail.com> wrote:
> On 11/29/05, Ryan Krauss <ryanlists at gmail.com> wrote:
> > But how can Python know how much space to save for the array if it
> > doesn't know the data type?
> >
>
> I wouldnt argue with you except that I was able to do this in Numeric.
> I could initialize an array to:
>
> foo = array([None]*1000)
>
> Then populate it with whatever I like afterwards.
>

Here is another problem (perhaps I should have started a new thread
for this, but its related): I have an array that I built up of lists
of floats. Here is a small, trivial example:

(Pdb) foo
Out[3]: array([[ 1.27826531  0.43086964], [ 1.27826531  0.43086964]],
dtype=object)

Try calling ravel():

(Pdb) foo.ravel()
Out[3]: array([[ 1.27826531  0.43086964], [ 1.27826531  0.43086964]],
dtype=object)

I see *why* this is happening, but I dont think that it should. I
expect an array of shape (4,) when I call ravel() on this array.

C.

--
Chris Fonnesbeck
Atlanta, GA



More information about the SciPy-user mailing list