MLearning.ai
Published in

MLearning.ai

A Guide to Using NumPy Functions on Arrays

Slicing and indexing with NumPy arrays, matrix operations and more..

Photo by Markus Spiske on Unsplash

When arrays need to be manipulated by mathematical operations, you just need to apply the operation on the array with respect to a numerical constant (a scalar) or an array of the exact same shape:

import numpy as np
a = np.arange(5).reshape(1,5)
a += 1

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store