The NumPy has a number of built-in functions which can be used for manipulation of elements in ndarray object. Below is the list of most commonly used functions for array manipulation:
Function | Description |
ndarray.flat |
A 1-D iterator over the array. |
reshape() |
Gives a new shape to an array without changing its data. |
ravel() |
Returns a contiguous flattened array. |
ndarray.flatten() |
Return a copy of the array collapsed into one dimension. |
Function | Description |
ndarray.T |
Returns the transposed array. |
rollaxis() |
Roll the specified axis backwards, until it lies in a given position. |
swapaxes() |
Interchange two axes of an array. |
transpose() |
Reverses or permutes the axes of an array. |
Function | Description |
concatenate() |
Returns a concatenated array along the specified axis. |
stack() |
Join a sequence of arrays along a new axis. |
hstack() |
Stack arrays in sequence horizontally (column wise). |
vstack() |
Stack arrays in sequence vertically (row wise). |
Function | Description |
split() |
Split an array into multiple sub-arrays. |
hsplit() |
Split an array into multiple sub-arrays horizontally (column-wise). |
vsplit() |
Split an array into multiple sub-arrays vertically (row-wise). |
Function | Description |
append() |
Appends values to the end of an array. |
resize() |
Return a new array with the specified shape. |
insert() |
Insert values along the given axis before the given indices. |
delete() |
Return a new array with sub-arrays along an axis deleted. |
unique() |
Find the unique elements of an array. |