In this video, you can run code in the notebook server and learn magic commands (%), shell escape (!), ?, ?? and Out/In history.
- [Instructor] Let's start working with our Jupyter notebook. The Jupyter notebook is composed of cells. Most of them will be code cells, and we'll cover markdown cells later. Code cells are cells that execute code and display the result. Let's start with something simple. Type 40 plus two in a cell, and then run it. To run the cell, we have two options. We can click on the run cell button, which looks like a play button next to the square button. You will see that the side of the cell change to In, and one in square brackets, it was empty before.
We also have an Out one, which is the output of the computation. Note that the new cell, which is in focus, was created for us so we can continue working. The other option to run a cell is by using the keyboard. You can either click Control + Enter to run the cell, or Shift + Enter to run the cell and create a new one below. The operator has many keyboard shortcuts to make working with it more efficient. You can view all of them in the Help Keyboard menu. As you can see, there are many shortcuts, and I'll mention some of them later, as we move through the course.
One feature for keyboard shortcut addicts like me is opening the command palette, which is Command + Shift + P on Mac, and on other systems, it's Control + Shift + P. From there you see all commands. Once you start typing, for example, run, the list shrinks to match what you're looking for. Once you see the command that you want, you can use the arrow keys to select and execute it. Let's get back to writing code. Let's import numpy by writing import numpy as np, and hitting Shift + Enter.
The line, import numpy as np, is very common and we use it a lot. The reason we're importing numpy this way is that there are many functions defining the model, and it's easy to refer them with the np doc prefix. Now that we have In  as well, on the left side. This is our history, and Jupyter makes it available for us. I can type Out and then  in square brackets, to get the result of the first computation. This is very handy when I run some computation and later want to use the result. Instead of free running with assigning the results to a variable, I can just say x = Out of one, and now I have the result, and again I'm going to hit Shift + Enter to view the result, and it's 42, and we can continue from there.
In the next cell, write np. and hit Tab. You will see a dropdown with all defined attributes in numpy. If you start typing, for example si, the dropdown will be filtered quickly only to the attributes that have the prefix that you wrote. So you can quickly select the function you're looking for. We can also start to write the function call, and then hit Shift + Tab, to view list of arguments. If you start writing a keyword argument, and then hit Tab, Jupyter will complete the name for us and will add the equals sign so it can provide the value.
- Working with Jupyter notebooks
- Using code cells
- Extensions to the Python language
- Markdown cells
- Editing notebooks
- NumPy basics
- Broadcasting, array operations, and ufuncs
- Folium and Geo
- Machine learning with scikit-learn
- Plotting with matplotlib and bokeh
- Branching into Numba, Cython, deep learning, and NLP
Skill Level Intermediate
1. Scientific Python Overview
2. The Jupyter Notebook
3. NumPy Basics
Manage environments5m 11s
6. Folium and Geo
7. NY Taxi Data
10. Other Packages
11. Development Process
Next steps1m 33s
- 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.Cancel
Take 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.