Skip to main content

Arrays and NumPy

Functions/methods for working with Arrays and NumPy.

arr[index]

Retrieve the element at position index in the array arr. The first element is arr[0].

np.append(arr, value)

A copy of arr with value appended to the end. This does not change arr unless you store the result in arr.

np.arange(start, stop, step)

An array of numbers starting with start, increasing/decreasing in increments of step, and stopping before (excluding) stop. If start or step are omitted, the default values are 0 and 1, respectively.

The number of non-zero entries in arr. True counts as 1, False counts as 0.

The pth percentile of the numbers in arr.

np.round(arr, decimals)

Rounds each element of an array to a specified number of decimal places.