[Numpy-discussion] discussion about array.resize() -- compare to numarray

Sebastian Haase seb.haase at gmx.net
Thu Jan 4 19:29:32 EST 2007


On 1/4/07, Sebastian Haase <haase at msg.ucsf.edu> wrote:
<snip>
> >>> N.__version__
> '1.0.2.dev3487'
>
> in any case:  inside the script it somehow generated a nan  --- is
> there a bug in numpy !?

No bug here ! see below !

> I remember that there was some discussion about resize  !?
> What should I add to the Scipy Wiki   numarray page about this  ?
> (   http://www.scipy.org/Converting_from_numarray  )
>

OK - the reference problem in my interactive shell came from the
implicit '_' variable that always references the last result. But
maybe even more worry some for the converting from numarray is this:
>>> a = N.array([5])
>>> 999  # to kill '_' - reference
999
>>> a.resize(2)
>>> a
[5 0]

in numarray you would get
>>> a = na.array([5])
>>> a.resize(2)
[5 5]
>>> a
[5 5]

!! why is numpy filling with 0s and numarray repeats (cycles I think
is more what it does !) the last element(s) ??

How did numeric do this ?

- Sebastian



More information about the NumPy-Discussion mailing list