Jupyter Notebooks Flashcards
JP: What is a Jupyter Notebook, and what is its high-level purpose?
Jupyter notebooks allow you to run code, display outputs and visualizations, and cleanly write accompanying text, all within one page in the web browser.
JP: Why do Jupyter notebooks make editing code easier? What is a way it particularly makes it easier for data science?
They allow you to edit and rerun only one chunk of code rather than all of it. For data science, this is especially helpful as you only need to load the data once, rather than rerunning a script over and over. (This is my assessment, not someone well informed’s.)
JP: How do you start a new notebook on your machine?
Because you have anaconda, simply run “jupyter notebook” at command line, then do “New -> Python 3” to start.
JP: How can you tell if you’re in edit mode?
There is a pencil icon in the top right corner of your window.
JP: Hot key to run a cell and move to next
Shift + enter
JP: What do the numbers next to the cells show?
The order in which cells were run
JP: How do we allow matplotlib plots to be used in our notebook
Run the line magic command “%matplotlib inline”
JP: How to simply time the execution of a python code block?
Include cell magic command “%%timeit” at top of cell
JP: Can you display the results of many evaluations without printing them?
Yes
JP: What does the star in brackets mean?
The code cell is still executing
JP: How do you quickly delete a cell?
Click the left part of the cell to view it in command mode, then hit d twice quickly
JP: Hotkey for inserting cell above
A (in command mode)
JP: Hotkey for inserting cell below
B (in command mode)
JP: Hotkey for changing cell to markdown
M (in command mode)
JP: Hotkey for changing cell to code
Y (in command mode)