Array creation routines#
See also
From shape or value#
  | 
Return a new array of given shape and type, without initializing entries.  | 
  | 
Return a new array with the same shape and type as a given array.  | 
  | 
Return a 2-D array with ones on the diagonal and zeros elsewhere.  | 
  | 
Return the identity array.  | 
  | 
Return a new array of given shape and type, filled with ones.  | 
  | 
Return an array of ones with the same shape and type as a given array.  | 
  | 
Return a new array of given shape and type, filled with zeros.  | 
  | 
Return an array of zeros with the same shape and type as a given array.  | 
  | 
Return a new array of given shape and type, filled with fill_value.  | 
  | 
Return a full array with the same shape and type as a given array.  | 
From existing data#
  | 
Create an array.  | 
  | 
Convert the input to an array.  | 
  | 
Convert the input to an ndarray, but pass ndarray subclasses through.  | 
  | 
Return a contiguous array (ndim >= 1) in memory (C order).  | 
  | 
Interpret the input as a matrix.  | 
  | 
Copies an array to a specified data type.  | 
  | 
Return an array copy of the given object.  | 
  | 
Interpret a buffer as a 1-dimensional array.  | 
  | 
Create a NumPy array from an object implementing the   | 
  | 
Construct an array from data in a text or binary file.  | 
  | 
Construct an array by executing a function over each coordinate.  | 
  | 
Create a new 1-dimensional array from an iterable object.  | 
  | 
A new 1-D array initialized from text data in a string.  | 
  | 
Load data from a text file.  | 
Creating record arrays#
Note
Please refer to Record arrays for record arrays.
  | 
Construct a record array from a wide-variety of objects.  | 
  | 
Create a record array from a (flat) list of arrays  | 
  | 
Create a recarray from a list of records in text form.  | 
  | 
Create a record array from binary data  | 
  | 
Create an array from binary file data  | 
Creating character arrays (numpy.char)#
Note
numpy.char is used to create character
arrays.
  | 
Create a   | 
  | 
Convert the input to a   | 
Numerical ranges#
  | 
Return evenly spaced values within a given interval.  | 
  | 
Return evenly spaced numbers over a specified interval.  | 
  | 
Return numbers spaced evenly on a log scale.  | 
  | 
Return numbers spaced evenly on a log scale (a geometric progression).  | 
  | 
Return a tuple of coordinate matrices from coordinate vectors.  | 
An instance which returns a dense multi-dimensional "meshgrid".  | 
|
An instance which returns an open multi-dimensional "meshgrid".  | 
Building matrices#
  | 
Extract a diagonal or construct a diagonal array.  | 
  | 
Create a two-dimensional array with the flattened input as a diagonal.  | 
  | 
An array with ones at and below the given diagonal and zeros elsewhere.  | 
  | 
Lower triangle of an array.  | 
  | 
Upper triangle of an array.  | 
  | 
Generate a Vandermonde matrix.  | 
The matrix class#
  | 
Build a matrix object from a string, nested sequence, or array.  |