Learn how to use boolean mask techniques for NumPy variables in this video tutorial by Charles Kelly. These are explained in the context of computer science and data science to technologists and students in preparation for machine learning, applied statis
- [Instructor] When you open the Boolean Mask Arrays file…in the exercises folder you'll see that it is pre-populated…with a numpy import statement,…and with a variable called my vector,…which is populated with a python list.…Before you begin using this interactive notebook,…you want to execute both of theses cells.…You can execute them both separately,…or you can go to the cell menu and select run all.…After you've selected run all you'll see that the values…in my vector are now in ND array,…and the values of the elements are exactly the same…as the values in the python list.…
Now I'm going to cut and paste the next cell…from the exercises file.…In it, I'm creating a new variable called…zero mod seven mask.…It takes on the values where my vector…is exactly divisible by seven.…In particular, the percentage sign is the remainder operator…and we're selecting all elements in the array…where the remainder after division…by seven is equal to zero.…I'm pressing shift + enter.…
We see that we've created an array of Boolean values.…
Author
Released
10/7/2016- Using Jupyter Notebook
- Creating NumPy arrays from Python structures
- Slicing arrays
- Using Boolean masking and broadcasting techniques
- Plotting in Jupyter notebooks
- Joining and splitting arrays
- Rearranging array elements
- Creating universal functions
- Finding patterns
- Building magic squares and magic cubes with NumPy and Python
Skill Level Intermediate
Duration
Views
Related Courses
-
Python: Data Analysis
with Michele Vallisneri2h 16m Intermediate
-
Introduction
-
Welcome40s
-
Install software1m 55s
-
-
1. Notebooks
-
Notebook basics8m 23s
-
Markdown4m 33s
-
Launch Jupyter Notebook2m 7s
-
2. Create NumPy Arrays
-
3. Index, Slice, and Iterate
-
Slice arrays7m 35s
-
Broadcasting11m 42s
-
Structured and record arrays10m 59s
-
-
4. Plots: Matplotlib and Pyplot
-
Inline plotting2m 46s
-
Figures and subplots5m 27s
-
Multiple lines, single plot6m 16s
-
Plot annotations5m 16s
-
Beautiful plots, the gallery4m 22s
-
-
5. Manipulate Arrays
-
Views and copies8m 19s
-
Array attributes1m 40s
-
Add and remove elements8m 53s
-
Join and split arrays6m 49s
-
Array shape manipulation4m 24s
-
Rearrange array elements5m 12s
-
Transpose like operations4m 24s
-
Tiling arrays3m 24s
-
-
6. Short Examples
-
Universal functions4m 47s
-
Pythagorean triangles3m 28s
-
Linear algebra8m 12s
-
Finding patterns7m 48s
-
Statistics8m 30s
-
Brain teasers12m 2s
-
-
7. Extended Examples
-
Magic squares and NumPy6m 57s
-
Adjacency matrix6m 19s
-
Magic characteristics5m 41s
-
Build magic cubes3m 48s
-
-
Conclusion
-
Next steps49s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Boolean mask arrays