Keywords: gildas-python

Next: Methods Up: NumPy basics Previous: NumPy basics Contents Index

#### Attributes

Attributes come with any `numpy.ndarray`. Among others we can mention:

- The `.shape` built-in attribute: is a Python tuple storing the dimensions of the input array.

- The `.dtype` built-in attribute: a `numpy.ndarray` brings its datatype in a special object called `dtype`, which can be retrieved with the `.dtype` attribute. Default type is `dtype('<i4')` (standard integer) for integers, and `'<f8'` (double precision) for floats. We will import different kind of numbers from SIC (different memory size allocated per element), so the dtypes will be one of `'<f8'` (double precision float), `'<f4'` (single precision float), `'<i4'` ( integers), or `'|S1'` (single characters).

- The `.itemsize` built-in attribute: is the size allocated in memory (in bytes) for each array element (see dtypes above).