NumPy Commands

#### Importing NumPy

Before any of the following commands are used, the NumPy library must be imported into Sage. This is done with the command

`import numpy`

You may also assign numpy a different name for convenience, such as `np`, using `as`:

`import numpy as np`

After importation, any numpy commands must be preceded by the name of the import and a dot operator like so: `np.array()`

#### NumPy Commands

This section assumes a basic knowledge of Python 2.

- Numpy Constants Constants defined in the NumPy package.
- Importing specialized NumPy packages Importing NumPy subclass packages.

#### N-Dimensional Arrays

Basic commands for NumPy's core function, the `ndarray` object.

- The N-Dimensional Array Using NumPy to create an array of n dimensions.
- Indexing in ndarray objects Using indices for multidimensional arrays.
- Accessing Attributes of N-Dimensional Arrays How to access information about an
`ndarray`object. - Evaluating Booleans in an N-Dimensional Array Using the
`all`and`any`methods to evaluate an`ndarray`of`bool`data. - Sum and Prod commands on ndarrays Using the
`ndarray``sum`and`prod`commands.

#### Statistics

- Finding the minimum and maximum of an ndarray object How to find the minimum and maximum values of an ndarray object.
- Finding the standard deviation and variance of an ndarray Using the
`std`and`var`commands to find the standard deviation and variance of an`ndarray`. - Finding the percentile of a value in an ndarray Using the
`percentile`and`nanpercentile`commands to find the percentile of an item in an`ndarray`. - Median of an ndarray Finding the median of an
`ndarray`object. - Average of an ndarray Finding the average of an
`ndarray`object.

#### Boolean Logic in NumPy

- Evaluating Booleans in an N-Dimensional Array Using the
`all`and`any`methods to evaluate an`ndarray`of`bool`data. - Testing ndarray objects for equivalence Using the
`array-equiv`command to test`ndarray`objects for equivalence. - Testing for Infinite Values Using
`numpy.isinf`to test a value for infinity. - Testing for Finite Values Using
`numpy.isfinite`to test a value for finiteness. - Testing for NaN values Using
`numpy.isnan`to test for a Not a Number value, such as $\frac{1}{0}$.