On this page
Array manipulation routines
Basic operations
  | 
      Copies values from one array to another, broadcasting as necessary.  | 
     
  | 
      Return the shape of an array.  | 
     
Changing array shape
  | 
      Gives a new shape to an array without changing its data.  | 
     
  | 
      Return a contiguous flattened array.  | 
     
A 1-D iterator over the array.  | 
     |
  | 
      Return a copy of the array collapsed into one dimension.  | 
     
Transpose-like operations
  | 
      Move axes of an array to new positions.  | 
     
  | 
      Roll the specified axis backwards, until it lies in a given position.  | 
     
  | 
      Interchange two axes of an array.  | 
     
The transposed array.  | 
     |
  | 
      Reverse or permute the axes of an array; returns the modified array.  | 
     
Changing number of dimensions
  | 
      Convert inputs to arrays with at least one dimension.  | 
     
  | 
      View inputs as arrays with at least two dimensions.  | 
     
  | 
      View inputs as arrays with at least three dimensions.  | 
     
Produce an object that mimics broadcasting.  | 
     |
  | 
      Broadcast an array to a new shape.  | 
     
  | 
      Broadcast any number of arrays against each other.  | 
     
  | 
      Expand the shape of an array.  | 
     
  | 
      Remove axes of length one from   | 
     
Changing kind of array
  | 
      Convert the input to an array.  | 
     
  | 
      Convert the input to an ndarray, but pass ndarray subclasses through.  | 
     
  | 
      Interpret the input as a matrix.  | 
     
  | 
      Return an array converted to a float type.  | 
     
  | 
      Return an array (ndim >= 1) laid out in Fortran order in memory.  | 
     
  | 
      Return a contiguous array (ndim >= 1) in memory (C order).  | 
     
  | 
      Convert the input to an array, checking for NaNs or Infs.  | 
     
  | 
      Convert an array of size 1 to its scalar equivalent.  | 
     
  | 
      Return an ndarray of the provided type that satisfies requirements.  | 
     
Joining arrays
  | 
      Join a sequence of arrays along an existing axis.  | 
     
  | 
      Join a sequence of arrays along a new axis.  | 
     
  | 
      Assemble an nd-array from nested lists of blocks.  | 
     
  | 
      Stack arrays in sequence vertically (row wise).  | 
     
  | 
      Stack arrays in sequence horizontally (column wise).  | 
     
  | 
      Stack arrays in sequence depth wise (along third axis).  | 
     
  | 
      Stack 1-D arrays as columns into a 2-D array.  | 
     
  | 
      Stack arrays in sequence vertically (row wise).  | 
     
Splitting arrays
  | 
      Split an array into multiple sub-arrays as views into   | 
     
  | 
      Split an array into multiple sub-arrays.  | 
     
  | 
      Split array into multiple sub-arrays along the 3rd axis (depth).  | 
     
  | 
      Split an array into multiple sub-arrays horizontally (column-wise).  | 
     
  | 
      Split an array into multiple sub-arrays vertically (row-wise).  | 
     
Tiling arrays
  | 
      Construct an array by repeating A the number of times given by reps.  | 
     
  | 
      Repeat elements of an array.  | 
     
Adding and removing elements
  | 
      Return a new array with sub-arrays along an axis deleted.  | 
     
  | 
      Insert values along the given axis before the given indices.  | 
     
  | 
      Append values to the end of an array.  | 
     
  | 
      Return a new array with the specified shape.  | 
     
  | 
      Trim the leading and/or trailing zeros from a 1-D array or sequence.  | 
     
  | 
      Find the unique elements of an array.  | 
     
Rearranging elements
  | 
      Reverse the order of elements in an array along the given axis.  | 
     
  | 
      Flip array in the left/right direction.  | 
     
  | 
      Flip array in the up/down direction.  | 
     
  | 
      Gives a new shape to an array without changing its data.  | 
     
  | 
      Roll array elements along a given axis.  | 
     
  | 
      Rotate an array by 90 degrees in the plane specified by axes.  | 
     
© 2005–2021 NumPy Developers
Licensed under the 3-clause BSD License.
 https://numpy.org/doc/1.20/reference/routines.array-manipulation.html