Other Useful Features - Jupyter
00:00 Hello. In this video, we’ll take a look at other useful features that come with using Jupyter Notebooks. Let’s take a look.
00:08 I made a little report here that we’re going to talk about—the different points—and it’s also a way to illustrate what you can do with Jupyter Notebooks.
00:16 The first point, therefore, is you can make really nice-looking Markdown reports, like using this Markdown feature and integration between code and Markdown. Yeah, you can do stuff like this. For example, have a table of contents in here where I can click around and it actually takes me to the different sections, right?
00:33 And you see it’s very nicely formatted right away, and that’s quite easy by just writing Markdown, where you can integrate HTML also, which I’ve done here—for example, making a link here so that we can then directly link to the different sections.
00:49 I just want to show you this as an example of how with using Jupyter Notebooks you can really nicely integrate code with images, with just text in between,
00:59 and by that—just by exporting it, finally—which you can do over here. Download as, for example, a PDF file—or you can just pick out the code. So, you can create a nice-looking report quite easily. Here, let’s see—we looked at that at the beginning, I want to show you again. Just creating some data, and then finally, I can have a plot that’s directly integrated here in my Notebook, so that it would also show up in the report that I’m generating. So that’s, I think, one of the most important features. Cool! Then the next one, the iPython magic commands.
01:38
This is something that comes with the iPython shell, so it’s not specific to Jupyter Notebooks in itself, but since Jupyter Notebooks are built on the iPython shell, you can use all the magic commands that come with it. So, there’s fun stuff, like, for example, this %%time
, which just gives you a quick way of seeing “How long did this code block take to execute?” And then there’s stuff like this %%timeit
, ha, which just runs your code block—it’s actually a hundred million times.
02:06 There you go, you see that? And it gives you, like, some mean standard deviation of how quickly does it run, which can help you to identify bottlenecks.
02:16 The next thing I want to show you is multicursor support. We saw this in some other editors, and you can do it in here as well if you’re press down the Alt key and then select something.
02:25 So, let’s go into the cell first. Now when I press Alt, you see that my cursor changes to a plus, and now when I hold it and I pull over that, and then I just pressed the Right arrow, so I have a couple of cursors here, so I can do nice stuff like this, also like this, go over, and then let’s just print them all out much quicker.
02:47 So, multicursor support also exists in Jupyter Notebooks, and it’s pretty easy to get it.
02:53
The next thing I want to show you is executing shell commands. You can do that right inside of Notebook by just prepending a code cell with a exclamation mark (!
).
03:02 So here, I’m using a Bash command to just print what’s inside. You can see this is what’s currently in the folder that I’m in. I can create things—here I am creating a file, and then let’s print again.
03:14 There you go. So, any sort of Bash command that you want to run, you can do it from within the Notebook by just prepending this exclamation mark. Pretty neat!
03:26
And then we have a final thing that I want to show you because part of this whole data science, Jupyter Notebook—we have a nice representation of things that really looks good. It’s also like, how do you show it to people? You don’t want to send around .ipynb
files, so instead, you can easily create a link to show it to people.
03:44 So I’ve uploaded this project to GitHub—I have it sitting over here. Actually, GitHub also displays this inside of here, so you can just show this link to people.
03:54
But if we want to have it nicer formated, there’s this project called NBViewer, where you can paste in a URL, for example, to this GitHub thing that I just uploaded to this .ipynb
Notebook—wherever you’re hosting it, right?
04:08 It just has to be a Notebook. And I can press Go! and it displays it for me, nicely rendered. There you go. And this has a unique URL now that renders it in this format. I can show you this—if I have fetch this and open up a new incognito window…
04:28 it’s still available. So you can share this link with anyone in your organization or friends and they can easily see—like, they can easily follow your description of the code that you went through and yeah, experience this nice integration. All right!
04:42 I hope you liked seeing these features that Jupyter Notebooks offers, and there’s way more—there’s tons of extensions and stuff that I haven’t touched on now.
04:51 Let’s take, in the next video, a quick look of ways that you can learn more about using Jupyter Notebooks. See you there.
Become a Member to join the conversation.