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

Stefan van der Walt stefan at sun.ac.za
Mon Jan 8 03:42:36 CST 2007


On Fri, Jan 05, 2007 at 01:57:50PM -0800, Russell E Owen wrote:
> I also checked the numpy 1.0.1 help and I confess I don't understand at 
> all what it claims to do if the new size is larger. It first says it 
> repeats a and then it says it zero-fills the output.
> 
> >>> help(numpy.resize)
> Help on function resize in module numpy.core.fromnumeric:
> 
> resize(a, new_shape)
>     resize(a,new_shape) returns a new array with the specified shape.
>     The original array's total size can be any size. It
>     fills the new array with repeated copies of a.
>     
>     Note that a.resize(new_shape) will fill array with 0's
>     beyond current definition of a.

The docstring refers to the difference between

N.resize(x,6)

and

x.resize(6)

Cheers
Stéfan


More information about the Numpy-discussion mailing list