Skip to content

Working in Notebooks


Learn how to use interactive notebooks for developing in Python.
Goku Mohandas
Goku Mohandas
· · ·
Repository ยท Notebook

Subscribe to our newsletter

๐Ÿ“ฌ  Receive new lessons straight to your inbox (once a month) and join 40K+ developers in learning how to responsibly deliver value with ML.


Set up

  1. Click on this link to open the accompanying notebook for this lesson or create a blank one on Google Colab.
  2. Sign into your Google account to start using the notebook. If you don't want to save your work, you can skip the steps below. If you do not have access to Google, you can follow along using Jupyter Lab.
  3. If you do want to save your work, click the COPY TO DRIVE button on the toolbar. This will open a new notebook in a new tab. Rename this new notebook by removing the words Copy of from the title (change Copy of 01_Notebooks to 1_Notebooks).
copy to google drive   rename file

Alternatives to Google Colab

Alternatively, you can run these notebooks locally by using JupyterLab. You should first set up a directory for our project, create a virtual environment and install jupyterlab.

mkdir mlops
python3 -m venv venv
source venv/bin/activate
pip install jupyterlab
jupyter lab

Types of cells

Notebooks are made up of cells. There are two types of cells:

  • code cell: used for writing and executing code.
  • text cell: used for writing text, HTML, Markdown, etc.

Text cells

Click on a desired location in the notebook and create the cell by clicking on the โž• TEXT (located in the top left corner).

text cell

Once you create the cell, click on it and type the following text inside it:

### This is a header
Hello world!

Run a cell

Once you type inside the cell, press the SHIFT and RETURN (enter key) together to run the cell.

Edit a cell

To edit a cell, double click on it and make any changes.

Move a cell

Move a cell up and down by clicking on the cell and then pressing the โฌ† and โฌ‡ button on the top right of the cell.

move cell

Delete a cell

Delete the cell by clicking on it and pressing the trash can button ๐Ÿ—‘๏ธ on the top right corner of the cell. Alternatively, you can also press โŒ˜/Ctrl + M + D.

delete cell

Code cells

Repeat the steps above to create and edit a code cell. You can create a code cell by clicking on the โž• CODE (located in the top left corner).

code cell

Once you've created the code cell, double click on it, type the following inside it and then press Shift + Enter to execute the code.

1
print ("Hello world!")

Hello world!

These are the basic concepts we'll need to use these notebooks but we'll learn few more tricks in subsequent lessons.


To cite this content, please use:

1
2
3
4
5
6
@article{madewithml,
    author       = {Goku Mohandas},
    title        = { Notebooks - Made With ML },
    howpublished = {\url{https://madewithml.com/}},
    year         = {2023}
}