Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Jupyter Notebook Menu Items

The Jupyter Notebook has several menus that you can use to interact with your Notebook. This is a list of the menus:

  • File
  • Edit
  • View
  • Insert
  • Cell
  • Kernel
  • Widgets

This lesson will go over the menus one by one. You’ll learn how to use the menus to combine markdown text with code, create checkpoints, modify cells, change the way data is presented, add widgets, and how to use the Notebook’s keyboard shortcuts.

00:00 Here we are again, and this time we’re going to talk about the menu items. I’ll move back over to Jupyter Notebooks. Here we are, back in the Notebook that we were working on before.

00:12 At this point I would just sneak in a little peek into something that makes Jupyter Notebooks really awesome, which is the possibility to combine Markdown and code cells.

00:23 I’ve talked about it before. So, I remove this cell…

00:28 and you can see here on the left side, we have this In that I talked about before, which tells us that this is a code cell in which we can execute Python code.

00:37 What I’m going to do now is I will change this one to a Markdown cell. You see that In disappears, and now I’m going to paste in a bit of text that I wrote before, which is essentially just us talking about the menu items.

00:51 You can see that it’s pre-formatted with this hashtag (#) before—it’s going to make a heading. And then once I run this cell, you can see that it’s nicely formatted. It looks like HTML, essentially.

01:03 We’ll talk more about Markdown later on, but I wanted to show you how fun it is to use Jupyter Notebooks also for keeping your workflow intact and in one place, so I’m just going to use it for my notes for what we want to talk about in here. So, looking at the menu items, we have the File menu up here, and one of the important things in there—like, this is where you can make new Notebooks, where you can open Notebooks, et cetera, make a copy.

01:35 And one that is interesting to highlight is Save and Checkpoint. Even though Jupyter Notebooks saves the work automatically pretty frequently—so you don’t have to worry about it too much—but sometimes you can come here, click Save and Checkpoint, and then you will have the Checkpoint created, here, you’ll have the time, and from then on you have the possibility to revert back to a checkpoint that you created.

01:58 The Edit menu item has a lot of useful functionality relating to how to deal with cells. You can cut them, copy them, paste them, et cetera—below or above the currently selected cell.

02:10 You can delete them and undo the deletions, et cetera. You can also split cells—let’s take a quick look at that. Depending on where I place my cursor—so, we’re currently at the **Edit** menu, I will put it in here—and I can say Split Cell, and then it splits the cell at this point and we have two Markdown cells right here that I can run separately.

02:37 In the same way, we can also combine cells back together—so, merge with the cell above—and we have one cell again. The next one I want to look at is the View menu item.

02:49 Here we can clean up a little. I can toggle the header, which we have up here. I can toggle the toolbar, make a bit more space, stay more focused. For now, we want to keep those because I want to talk a bit about the items.

03:10 Talking about the header, here’s a way that we can just give a name to our Jupyter Notebook, simply by hovering on the title, that’s currently still Untitled.

03:20 You can click in there and give the Notebook a name…

03:28 and click Rename, and then we have a name to our Notebook.

03:35 I will actually take out this header now so that we have a bit more space.

03:42 Okay!

03:44 The next one is the Cell menu item. In this one we can decide to run a cell, or run all of the cells at one point—this is often useful if you’re opening a Notebook anew that you’ve already written code in—sometimes you just want to run all the cells.

04:05 I can click this one. In here, you can also change the type of the cell.

04:12 Because you might have the question “What is this Raw NBConvert?”—we’re going to talk about it a bit later, but it’s related to if you export a Jupyter Notebook, you can give some specific instructions on how to deal with that export.

04:26 It’s not something you would use very often. Generally, you’re going to deal with code and Markdown cells. At that point, I also want to show you some keyboard shortcuts.

04:36 I hardly ever use these menus up here because there’s pretty handy keyboard shortcuts—for example, for creating a new cell, for which we also have this menu item up here for adding a cell.

04:48 There’s also a keyboard shortcut that is set to b, so pressing b inserts a cell below, and pressing a inserts a cell above. So, I would go here, select that and press athen it inserts a cell above the currently selected cell.

05:07 And another one that I use very frequently is x, and x just cuts a cell, so that’s a way you can get rid of cells that you don’t need.

05:21 Another way to change the type of cell that we already looked at quickly is you can come here and then select which cell you want. Heading here is a legacy, this doesn’t exist anymore. If I changed to Heading, we get this information that this is not meant to be used, so you just want to use Markdown for that. This would include a heading, and if we make a cell that would only contain a heading, we would do it like this: come here, change to Markdown, then # Our heading, and execute.

06:04 Let me make that look pretty. I’m using the Run shortcut, which is Shift + Enter. So, the next thing we want to look at is the Kernel.

06:14 Generally, you’re probably not going to deal with this very much. You can, in here, interrupt the kernel, restart it, or even change it to a different kernel. Currently, we just have access to a Python 3 one.

06:25 But sometimes when your code gets stuck, you might want to come in here and then Restart & Clear Output or just Restart & Run All to start over again.

06:38 The second-to-last menu item here is the Widgets menu item. I currently don’t have anything in here, but you can install additional widgets that allow users of your Notebook or viewers of your Notebook to interact with data visualizations that you have. There’s map extensions, and then there’s 3D animation extensions—et cetera, et cetera—and you can access those over Widgets. And the final menu item is Help. In here, you can find help about Jupyter Notebooks, as well as something that’s useful to get the keyboard shortcuts up. And in here, you can always check up on what are useful keyboard commands.

07:19 There’s a lot of them, so don’t worry too much about it, but a couple of them are very useful and you’re going to be using some of them very frequently. For example, create cells, delete cells—or run a cell, with Shift + Enter.

07:36 And that wraps up the menu items. In the next section, we’re going to take a look at what other things we can create with the Jupyter Notebook server.

Avatar image for NotoriousBiagi

NotoriousBiagi on March 23, 2019

Really excellent materials in this course. I’m planning to leverage Jupyter Notebook for conducting an introductory Python course for a corporate workshop. Thanks for all the intel. One note, that the title of this video needs a trivial update to become Jupyter Notebook Menu Items. In this instance, the video header presently says Jupyer. Thanks!

Avatar image for Dan Bader

Dan Bader RP Team on March 23, 2019

Thanks, I just fixed the typo. Great to hear you’re enjoying the course! And good luck with your workshop :)

Avatar image for Vincenzo Fiorentini

Vincenzo Fiorentini on March 27, 2019

Hi, I just wanted to point out that the kernel restart from menu is sometimes useful to restart with a clean slate, as is sometimes needed if the nb grows in size.

Avatar image for Martin Breuss

Martin Breuss RP Team on April 20, 2019

Good point! Yes, you can restart the kernel through the menu item Kernel > Restart. Also useful in case one of your code cells hangs and stays stuck in execution. You can notice that’s the case if info on the left of the cell keeps displaying the star * instead of a number, like so: In [*]:.

Avatar image for David M

David M on June 21, 2019

Regarding widgets, I recommend installing the collapsible / expandable cell option (known as code folding) via nbextensions. It helps you shrink larger blocks of code (such as functions) to save screen space and reduce confusion.

Avatar image for kwf777

kwf777 on Jan. 14, 2020

I coud nt get a and b to work on inserting cells on my Mac - is there a special key combination for the Mac?

Avatar image for Chris Bailey

Chris Bailey RP Team on Jan. 14, 2020

Hi @kwf777, The trick for using the a and b shortcuts is being in “command mode”, which is indicated by the currently selected cell having a blue colored bar on its left. When your cursor is within a cell, this colored bar is green, and pressing a or b ends up typing into the cell, which is probably what you are experiencing. To get into command mode you can click with your mouse, just outside a cell, or to the left of a cell where it says “In[ ]”. Or what may work best is to press the “escape” key, to enter “command mode”.

Avatar image for DoubleA

DoubleA on Feb. 8, 2021

@Martin, just wanted to add that the “markdown” mode supports a lot of html-tags. Basically, you can type html directly in those cells, which, eventually, allows one to make his/her notes more readable by using different text formatting tags, anchor tags, color settings for texts, etc. This is a pretty powerful feature too, but like I mentioned in my previous comment under the previous vid, all this makes your JNs to crash eventually :(

Become a Member to join the conversation.