Colab notes and hints

For those who choose to edit directly in Colab.

Navigate Google Drive files within Colab

Sometimes, you may save a file within Colab and not know how to retrieve it, i.e., where it “went”. It gets placed within a folder you can reveal as follows.

Click the “folder” icon on the lefthand sidebar to navigate the directory structure within your Google Drive.

where to click to be able to access files on Google Drive in Colab

Here is what you will see after clicking on the relevant parts of the revealed directory tree (some folder names redacted):

expanded Google Drive directory tree in the lefthand sidebar

Reduce scrolling: use the “Table of Contents” feature

Rather than scrolling up and down in a notebook, you can expose the “table of contents” sidebar to navigate to different sections more quickly.

where to click to get table of contents for a notebook in Colab

Here is what you will see after clicking on the table-of-contents icon:

The Table of Contents shows up as a left-hand sidebar

See/edit two cells at once, or pin one cell and scroll through the rest of the code

Tired of scrolling between two cells (e.g., because you repeatedly need to edit one and run the other), or want to have one cell pinned to your view while you navigate around the code?

B E H O L D:

location of the 'mirror cell' button

Below, see that you can scroll on the left-hand side and still have the cell in the right-hand side pinned.

Note that you can edit on both sides (lefthand side and mirrored cell); the changes propagate to the “other side”.

full notebook to the left, pinned cell to the right

How do you enter data for a shell prompt?

There is no blinking cursor to indicate a text entry field produced by a shell prompt:

it is not obvious that one can enter text right after the prompt

The text-entry area is revealed if you click on the white space right after the prompt.

clicking on the whitespace after the prompt reveals a text entry box