Next: Subarrays and derivates
Up: NumPy basics
Previous: Methods
Contents
Index
Functions must be imported from NumPy module. Among others:
- The array() built-in function: returns a numpy.ndarray from a list of elements
(or list of lists,...), from a tuple (or tuple of tuples,...), or even from
any valid numpy.ndarray. The array constructor also takes an optional dtype (see
above), an optional savespace argument, and an optional copy
argument (see below).
Try also ones() or zeros() with a tuple containing dimensions as
argument to create new arrays.
- The size() built-in function: displays the number of elements of the
input array.
- The rank() built-in function: displays the number of dimensions of the
input array (0 = scalar, 1 = vector, etc).
- The len() built-in function: displays the number of elements of the
input array along the first dimension.
- See also: reshape().
Gildas manager
2014-07-01