Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Getting Setup5:26 with Craig Dennis
Let's get our Jupyter Notebook and miniconda environment all setup.
There are a couple of ways to get things installed here, but by far 0:00 the best way to experiment with a package in my opinion is by using Anaconda. 0:03 If you haven't heard of Anaconda, 0:07 it's a distribution of all the popular Python data libraries. 0:09 I'm actually going to use a smaller version of it called Miniconda, but 0:12 either will do. 0:16 We offer content on how to get it installed if you don't have it already, 0:16 it's in the teacher's notes. 0:19 If you don't have a Minconda or Anaconda installed, why don't you pause me and 0:21 get that installed and then come follow along. 0:24 Let's get things cooking. 0:26 So here I am at my command prompt, and 0:29 I'm gonna make sure that I have Conda installed. 0:31 So I'll type conda --version, awesome, I do. 0:33 Okay, now I'll create a directory called intro-to-numpy, 0:38 and I'm gonna change to that directory, so cd intro-to-numpy. 0:44 And now, I'll make sure that I create a new environment. 0:51 So I'm gonna say conda create, and I'm gonna name it 100 days. 0:55 And then what we want to install is numpy and jupyter, 1:02 you just kinda list them off here, the things that you want. 1:06 So we definitely want numpy and jupyter. 1:10 And this will kick off and set everything up for us. 1:13 And Conda saves environments to make sure that things are always at the right 1:17 version, by providing a virtual environment. 1:20 So, I'm gonna let this go, it's gonna take a little bit, see you when it's done. 1:24 And there we go, everything is all installed, awesome. 1:28 So, I'll activate our new environment. 1:31 So, let's say conda activate 100 days. 1:33 And I've got a big air message here. 1:39 Let's go ahead and I'm gonna grab this here, this echo, 1:41 we're gonna echo into our profile.d file here on Mac. 1:47 Let's paste that here. 1:53 So now that I've pasted that into the profile D I need to restart my bash. 1:55 So, I can say bash profile and 2:00 now, I should be able to say conda 2:04 activate 100days, awesome. 2:09 And now, I can open up our Jupyter server. 2:14 So I'll say jupyter notebook. 2:17 And that popped open a brand-new window, which I'll bring over here to us. 2:22 And I'm going to choose, over here, this New., we'll do new Python 3 notebook. 2:29 And I'm gonna come up here and I'm going to 2:35 rename this to introduction to NumPy, okay? 2:39 And I want this first cell here, I'm gonna make this first cell Markdown. 2:44 And I'm gonna write heading one of introduction to Numpy, and 2:50 I will just say learning Numpy. 2:55 So I'd like to repeat that I'd love for you to follow along and 2:59 make your own notebook. 3:02 I'll give you mine when the course is over so you can have all of my notes, but 3:04 please feel free to make your own comment. 3:07 I find that when using these notebooks, 3:09 it helps to capture your thoughts to review later. 3:11 I really liked using these for cheat sheets. 3:13 So we can actually run this cell and 3:16 enter the next one by choosing option enter on a Mac. 3:18 So option enter. 3:22 Just a quick heads up, I love keyboard shortcuts, 3:23 you can pick up some great productivity by learning them. 3:26 So, open the list here, and kinda type what it was that you were looking to do. 3:29 So we were looking to run that cell. 3:34 So if I type run, and we'll see here we have run cell and insert below. 3:36 That's what I did, so this is option enter, 3:40 this'll look different if you're running this on Windows. 3:42 Pretty cool, right? 3:44 Okay, so the new cell that was created here is Python by default, all right? 3:46 So it's code. 3:50 I wanna make sure that we got things installed correctly, so 3:51 what I'm gonna do is I'm going to import NumPy. 3:54 Now, as it turns out, data scientists are just as lazy as programmers and 3:57 don't like typing more than we need to. 4:01 So, a very common way to use NumPy is to import it as NP. 4:04 So, you say Import numpy as np. 4:09 And that will allow you to skip some unnecessary characters, 4:15 we don't wanna type more than we need to. 4:19 Well, of course, that stands for NumPy, but I like to think of it as no problem. 4:21 And that's because when we're done here, NumPy will be no problem. 4:27 Like most great libraries, the NumPy module exposes it's dunder version. 4:31 So we'll just write that here, let's put that in the same cell here. 4:36 We'll say, np.__verson. 4:38 And remember in Jupiter notebooks, when you run a cell, the last line, 4:41 it will show its output. 4:46 So here we go, and you'll see that I'm running 1.14.5. 4:47 Now, you are most likely using a more current version than I am. 4:53 And there shouldn't be any breaking changes for 4:56 this course between your version and mine. 4:58 With that said, I can't predict the future yet. 5:00 So, therefore, 5:04 if there are any problems, I'll makes sure to list those in the teacher's notes. 5:05 So please, take a moment right now to check those out, 5:09 I don't want you to have any problems. 5:12 I want you to have no problem, np, with NumPy, np. 5:13 Alright, now that we have our environment all set up correctly, 5:18 let's dive into learning the most critical data structure of NumPy, the array. 5:21
You need to sign up for Treehouse in order to download course files.Sign up