Learn about working with Jupyter Notebook.
- [Instructor] Jupyter notebooks offer a very convenient way to write code, run it, and collect the results, including plots, in a single document. You can even write documentation. This is my favorite way of using Python. We start a notebook by typing jupyter notebook in a terminal. A web browser opens and I can choose if I wish to load an existing notebook from the file system or to start a new one, which I do at the top right of the screen.
See this green box, it's a cell. It's ready for me to write some Python. Then I execute it by pressing shift + enter together. The output is printed immediately below it. I can click inside a cell, modify it, and execute it again. To write in the next cell, I press enter. The box around it becomes green and I can start writing.
I can write the function over multiple lines, and the editor will highlight the Python source for me. Again, I execute with shift + enter. This time, I would like to write some text, not code, so I can use the menu option cell, cell type, and markdown. Again, I start writing by pressing enter. Markdown is a simple text format that can do bold, bullet points, la-tic formulas, and much more.
I get out of the cell with shift + enter. To copy a cell, I use the arrow keys to move the blue selection box on it, then press esc + C, and then esc + V to paste it, to cut a cell, esc + X, to delete it, D + D, to create a new cell, esc + B. These are the most useful shortcuts but there are also many options to do all of these.
The notebook is saved periodically for us, but I can also do it at any time with command + S. I give the notebook a name by clicking at the top of the window. Go find the Jupyter Notebook documentation at jupyter.org, with a y. There are many great things to discover about it or just explore.
- Installing and setting up Python
- Importing and cleaning data
- Visualizing data
- Describing distributions and categorical variables
- Using basic statistical inference and modeling techniques
- Bayesian inference