Skip to main content

Arrays and NumPy

Functions/methods for working with Arrays and NumPy.

arr[index]

Retrieves the element at the index-th position in 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 beginning at start, increasing in increments of step, and ending before stop. If start or step is omitted, the default values will be 0 and 1, respectively.

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

The p-th percentile of the numbers in arr.

np.round(arr, decimals)

Rounds each element of arr to the decimals number of places.