Array manipulation routines

Changing array shape

reshape (a, newshape[, order]) Gives a new shape to an array without changing its data.
ravel (a[, order]) Return a flattened array.
ndarray.flat A 1-d flat iterator.
ndarray.flatten ([order]) Collapse an array into one dimension.

Transpose-like operations

rollaxis (a, axis[, start]) Roll the specified axis backwards, until it lies in a given position.
swapaxes (a, axis1, axis2) Interchange two axes of an array.
ndarray.T Same as self.transpose() except self is returned for self.ndim < 2.
transpose (a[, axes]) Permute the dimensions of an array.

Changing number of dimensions

atleast_1d (*arys) Convert inputs to arrays with at least one dimension.
atleast_2d (*arys) View inputs as arrays with at least two dimensions.
atleast_3d (*arys) View inputs as arrays with at least three dimensions.
broadcast
broadcast_arrays (*args) Broadcast any number of arrays against each other.
expand_dims (a, axis) Expand the shape of an array.
squeeze (a) Remove single-dimensional entries from the shape of an array.

Changing kind of array

asarray (a[, dtype, order]) Convert the input to an array.
asanyarray (a[, dtype, order]) Convert the input to a ndarray, but pass ndarray subclasses through.
asmatrix (data[, dtype]) Interpret the input as a matrix.
asfarray (a[, dtype]) Return an array converted to float type.
asfortranarray (a[, dtype]) Return an array laid out in Fortran-order in memory.
asscalar (a) Convert an array of size 1 to its scalar equivalent.
require (a[, dtype, requirements]) Return an ndarray of the provided type that satisfies requirements.

Joining arrays

append (arr, values[, axis]) Append values to the end of an array.
column_stack (tup) Stack 1-D arrays as columns into a 2-D array
concatenate ((a1, a2, ...)[, axis]) Join a sequence of arrays together.
dstack (tup) Stack arrays in sequence depth wise (along third axis)
hstack (tup) Stack arrays in sequence horizontally (column wise)
vstack (tup) Stack arrays vertically.

Splitting arrays

array_split (ary, indices_or_sections[, axis]) Split an array into multiple sub-arrays of equal or near-equal size.
dsplit (ary, indices_or_sections) Split array into multiple sub-arrays along the 3rd axis (depth).
hsplit (ary, indices_or_sections) Split array into multiple sub-arrays horizontally.
split (ary, indices_or_sections[, axis]) Split an array into multiple sub-arrays of equal size.
vsplit (ary, indices_or_sections) Split array into multiple sub-arrays vertically.

Tiling arrays

tile (A, reps) Construct an array by repeating A the number of times given by reps.
repeat (a, repeats[, axis]) Repeat elements of an array.

Adding and removing elements

delete (arr, obj[, axis]) Return a new array with sub-arrays along an axis deleted.
insert (arr, obj, values[, axis]) Insert values along the given axis before the given indices.
resize (a, new_shape) Return a new array with the specified shape.
trim_zeros (filt[, trim]) Trim the leading and trailing zeros from a 1D array.
unique (x) Return the sorted, unique elements of an array or sequence.

Rearranging elements

fliplr (m) Left-right flip.
flipud (m) Up-down flip.
reshape (a, newshape[, order]) Gives a new shape to an array without changing its data.
roll (a, shift[, axis]) Roll array elements along a given axis.
rot90 (m[, k]) Rotate an array by 90 degrees in the counter-clockwise direction.