Locked lesson.
About this lesson
We're going to use Jupyter Notebooks throughout the rest of the course to do all our coding, so in this video, let's install and start using it.
Exercise files
Download this lesson’s related exercise files.
Installing and Using Jupyter Notebooks.docx57 KB Installing and Using Jupyter Notebooks - Solution.docx
55.5 KB
Quick reference
Installing and Using Jupyter Notebooks
In this video we'll install and run Jupyter Notebooks.
When to use
You'll only need to install Jupyter Notebooks once, but you'll use these instructions to run it anytime you wish to use it.
Instructions
To install, make sure your virtual environment is activated and that you're in your /c/data directory; then issue this command:
pip install jupyter
To run Jupyter Notebooks, make sure your virtual environment is activated and that you're in your /c/data directory; then issue this command:
jupyter notebook
Hints & tips
- Install: pip install jupyter
- Run: jupyter notebook
- 00:05 Okay, so we've got our virtual environment turned on, now it's time to install and
- 00:08 start using Jupyter notebooks.
- 00:10 So we're going to use Jupyter notebooks throughout the rest of the course,
- 00:13 to do all of our coding, to run all of our coding Do all of our data analysis work.
- 00:18 And before we do that, obviously, we need to install it.
- 00:20 So we do that straight here from the command prompt.
- 00:23 And to do it, all we do is pip install jupyter.
- 00:25 Now, it's J-U-P-Y-T-E-R and the py stands for Python.
- 00:32 So it's Jupyter but with py instead of pi, all right?
- 00:35 So you go ahead and hit Enter.
- 00:37 Now make sure that you're in your C data directory,
- 00:40 make sure that your virtual environment has been turned on.
- 00:43 And you can see it's now downloading and
- 00:45 installing all kinds of cool things for us.
- 00:49 And this could take a few seconds to finish and
- 00:51 you could see there's a whole bunch of stuff right here that it's installing.
- 00:57 And we really don't care what most of this stuff is.
- 00:59 This is all going to work behind the scenes for Jupyter notebooks and
- 01:03 it will just work for us.
- 01:05 And that's really all we care about.
- 01:06 So let's just wait a second here for this to finish installing.
- 01:10 Okay, so it's finished installing, so
- 01:11 I can clear the screen now with the clear command.
- 01:15 Now remember in the last video, we typed in pip freeze and
- 01:18 there was nothing listed.
- 01:19 Now when we do, there's a whole bunch of stuff listed.
- 01:23 And you'll notice this has just been installed in our virtual environment.
- 01:28 If I use the deactivate command, and
- 01:30 then pip freeze, none of these things will be listed, because they've only been
- 01:33 installed inside of our virtual environment, which is very cool.
- 01:37 So all right, I'll go ahead and clear the screen.
- 01:39 Now to actually run Jupyter notebooks and this is what you'll need to do anytime you
- 01:44 want to run Jupyter notebooks from now on, you just come over here to the terminal
- 01:48 and type in Jupyter note book, all right?.
- 01:53 And when you do, a bunch of stuff pops up, and
- 01:57 your web browser automatically opens and we have this Jupyter notebook.
- 02:01 So this is the Jupyter notebook.
- 02:02 So you can see we're in that directory
- 02:05 because there's our virtual folder that we had before.
- 02:08 And we could just come over here to new, we want a new Python three notebook.
- 02:13 And when we do this thing pops up.
- 02:15 So let's go ahead and click this untitled thing and let's name this something.
- 02:18 And let's just name this data.
- 02:21 So we can click Rename and now this notebook has been created.
- 02:25 So this is our Jupyter notebook.
- 02:27 This is where we're going to be working throughout the rest of the course.
- 02:29 Now this has been saved in that same directory in our C data directory.
- 02:36 In fact, I can go open and Windows File Explorer.
- 02:41 And I can navigate to my C drive and go to that data directory.
- 02:45 And when I do we see this data.ipynb file, that's the notebook we just saved.
- 02:51 Remember we named it data, this is it right here.
- 02:54 So this notebook will autosave for us as we go along or
- 02:58 you can in any time come up here to file and click Save.
- 03:03 If you click Save As, you're going to want to name it the same data.
- 03:09 And when you do it says are you sure you want to overwrite?
- 03:11 Yes, but they should auto save for you every now and then, so you should be fine.
- 03:18 So this is our Jupyter notebook, very, very cool, and
- 03:20 just right here, we can run any Python coding that we want.
- 03:24 So if we wanted to go 2 + 2 now in order to run these cells,
- 03:27 hold down the Shift key and the Enter key on your keyboard at the same time.
- 03:31 And you can see boom, it outputs to 4.
- 03:33 We could do regular Python we can print, hello world.
- 03:37 Now if we Shift+Enter, boom, it prints out hello world.
- 03:40 We can come back here and edit any of these cells anytime we want.
- 03:44 To change it to 2 + 4, for instance, we Shift+Enter, boom, we see 6.
- 03:49 So this is Jupyter notebooks get used to this,
- 03:51 we're going to be using this throughout the rest of the course.
- 03:53 It is a lot of fun to use, very easy to use.
- 03:55 As you can see, it's just a matter of typing in the things we want to do, and
- 03:59 Shift+Enter to run them.
- 04:02 And you can do multiple lines if you want, all right?
- 04:06 So very, very cool.
- 04:07 So we now have all the main tools that we need.
- 04:10 We've got our Jupyter notebook set up.
- 04:12 We've got our Python running, we've got our get bash terminal in the background.
- 04:16 And you'll notice if we go back here, this thing is just running now.
- 04:20 This needs to keep running as long as we want to use our Jupyter notebook, right?
- 04:25 As soon as this stops, this won't work anymore.
- 04:29 So you need to keep it running in that terminal
- 04:32 as long as you want to use this notebook.
- 04:34 So that's all for this video.
- 04:35 In the next video, we will start looking at actual data analysis stuff,
- 04:39 we'll install NumPy, which is one of the main libraries and
- 04:42 programs we're going to use for our data analysis.
- 04:44 And that'll be coming up in the next video
Lesson notes are only available for subscribers.