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]]
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access