Name
resize
Synopsis
resize(a
,shapetuple
)
Returns an array r
with shape
shapetuple
and data copied from
a
. If
r
’s size is smaller than
a
’s size,
r
.flat
is copied from
the start of
ravel(
a
)
;
if r
’s size is larger,
the data in
ravel(
a
)
is replicated as many times as needed. In particular,
resize(
s
,(
n
*len(
s
),))
has the sequence replication semantics that
s
*
n
would have if s
were a generic Python
sequence rather than an array. For example:
print Numeric.resize(range(5),(3,4)) # prints: [[0 1 2 3] # [4 0 1 2] # [3 4 0 1]]
Get Python in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.