nlcpy.array
- nlcpy.array(object, dtype=None, copy=True, order='K', subok=False, ndmin=0)[source]
- Creates an array. - Parameters
- objectarray_like
- An array, any object exposing the array interface, an object whose __array__ method returns an array, or any (nested) sequence. 
- dtypedtype, optional
- The desired dtype for the array. If not given, then the type will be determined as the minimum type required to hold the objects in the sequence. This argument can only be used to ‘upcast’ the array. For downcasting, use the .astype(t) method. 
- copybool, optional
- If true (default), then the object is copied. Otherwise, a copy will only be made if __array__ returns a copy, if object is a nested sequence, or if a copy is needed to satisfy any of the other requirements (dtype, order, etc.). 
- order{‘K’, ‘A’, ‘C’, ‘F’}, optional
- Specify the memory layout of the array. If object is not an array, the newly created array will be in C order (row major) unless ‘F’ is specified, in which case it will be in Fortran order (column major). If object is an array the following holds. - order - no copy - copy=True - ‘K’ - unchanged F & C order preserved,otherwise most similar order- ‘A’ - unchanged F order if input is Fand not C, otherwise C order- ‘C’ - C order - C order - ‘F’ - F order - F order - When - copy=Falseand a copy is made for other reasons, the result is the same as if- copy=True, with some exceptions for A, see the Notes section. The default order is ‘K’.
- subokbool, optional
- If True, then sub-classes will be passed-through, otherwise, the returned array will be forced to be a base-class array (default). subok=True is Not Implemented. 
- ndminint, optional
- Specifies the minimum number of dimensions that the resulting array should have. Ones will be prepended to the shape as needed to meet this requirement. 
 
- Returns
- outndarray
- An array object satisfying the specified requirements. 
 
 - See also - empty_like
- Returns a new array with the same shape and type as a given array. 
- ones_like
- Returns an array of ones with the same shape and type as a given array. 
- zeros_like
- Returns an array of zeros with the same shape and type as a given array. 
- full_like
- Returns a full array with the same shape and type as a given array. 
- empty
- Returns a new array of given shape and type, without initializing entries. 
- ones
- Returns a new array of given shape and type, filled with ones. 
- zeros
- Returns a new array of given shape and type, filled with zeros. 
- full
- Returns a new array of given shape and type, filled with fill_value. 
 - Restriction - object[i].shape not equals to object[j].shape for some i,j : NotImplementedError occurs. 
 - Examples - >>> import nlcpy as vp >>> vp.array([1, 2, 3]) array([1, 2, 3]) - Upcasting: - >>> vp.array([1, 2, 3.0]) array([1., 2., 3.]) - More than one dimension: - >>> vp.array([[1, 2], [3, 4]]) array([[1, 2], [3, 4]]) - Minimum dimensions 2: - >>> vp.array([1, 2, 3], ndmin=2) array([[1, 2, 3]]) - Type provided: - >>> vp.array([1, 2, 3], dtype=complex) array([1.+0.j, 2.+0.j, 3.+0.j])