Locked lesson.
About this lesson
Numpy has universal functions built into it that we can play with and use. In this video, we'll discuss square roots, absolute values, exponents, and more.
Exercise files
Download this lesson’s related exercise files.
Numpy Universal Functions.docx57.1 KB Numpy Universal Functions - Solution.docx
55.5 KB
Quick reference
Numpy Universal Functions
Numpy comes with several universal functions.
When to use
Use these whenever you want to do a specific thing to your array.
Instructions
A list of Universal Functions can be found at:
https://docs.scipy.org/doc/numpy/reference/ufuncs.html
Given a Numpy Array named my_arr, here are some common functions:
np.sqrt(my_arr)
np.absolute(my_arr)
np.exp(my_arr)
my_arr ** my_arr
np.max(my_arr)
np.min(my_arr)
np.sign(my_arr)
np.sin(my_arr)
np.cos(my_arr)
np.log(my_arr)
Hints & tips
Login to downloadLesson notes are only available for subscribers.