1 00:00:00,570 --> 00:00:03,410 There are a couple of ways to get things installed here, but by far 2 00:00:03,410 --> 00:00:07,538 the best way to experiment with a package in my opinion is by using Anaconda. 3 00:00:07,538 --> 00:00:09,338 If you haven't heard of Anaconda, 4 00:00:09,338 --> 00:00:12,585 it's a distribution of all the popular Python data libraries. 5 00:00:12,585 --> 00:00:16,018 I'm actually going to use a smaller version of it called Miniconda, but 6 00:00:16,018 --> 00:00:16,816 either will do. 7 00:00:16,816 --> 00:00:19,213 We offer content on how to get it installed if you don't have it already, 8 00:00:19,213 --> 00:00:21,120 it's in the teacher's notes. 9 00:00:21,120 --> 00:00:24,480 If you don't have a Minconda or Anaconda installed, why don't you pause me and 10 00:00:24,480 --> 00:00:26,670 get that installed and then come follow along. 11 00:00:26,670 --> 00:00:27,540 Let's get things cooking. 12 00:00:29,060 --> 00:00:31,250 So here I am at my command prompt, and 13 00:00:31,250 --> 00:00:33,680 I'm gonna make sure that I have Conda installed. 14 00:00:33,680 --> 00:00:38,780 So I'll type conda --version, awesome, I do. 15 00:00:38,780 --> 00:00:44,925 Okay, now I'll create a directory called intro-to-numpy, 16 00:00:44,925 --> 00:00:51,426 and I'm gonna change to that directory, so cd intro-to-numpy. 17 00:00:51,426 --> 00:00:55,674 And now, I'll make sure that I create a new environment. 18 00:00:55,674 --> 00:01:02,407 So I'm gonna say conda create, and I'm gonna name it 100 days. 19 00:01:02,407 --> 00:01:06,288 And then what we want to install is numpy and jupyter, 20 00:01:06,288 --> 00:01:10,815 you just kinda list them off here, the things that you want. 21 00:01:10,815 --> 00:01:13,485 So we definitely want numpy and jupyter. 22 00:01:13,485 --> 00:01:17,315 And this will kick off and set everything up for us. 23 00:01:17,315 --> 00:01:20,645 And Conda saves environments to make sure that things are always at the right 24 00:01:20,645 --> 00:01:24,115 version, by providing a virtual environment. 25 00:01:24,115 --> 00:01:27,585 So, I'm gonna let this go, it's gonna take a little bit, see you when it's done. 26 00:01:28,840 --> 00:01:31,560 And there we go, everything is all installed, awesome. 27 00:01:31,560 --> 00:01:33,826 So, I'll activate our new environment. 28 00:01:33,826 --> 00:01:39,243 So, let's say conda activate 100 days. 29 00:01:39,243 --> 00:01:41,544 And I've got a big error message here. 30 00:01:41,544 --> 00:01:47,486 Let's go ahead and I'm gonna grab this here, this echo, 31 00:01:47,486 --> 00:01:53,203 we're gonna echo into our profile.d file here on Mac. 32 00:01:53,203 --> 00:01:55,929 Let's paste that here. 33 00:01:55,929 --> 00:02:00,549 So now that I've pasted that into the profile D I need to restart my bash. 34 00:02:00,549 --> 00:02:04,738 So, I can say bash profile and 35 00:02:04,738 --> 00:02:09,430 now, I should be able to say conda 36 00:02:09,430 --> 00:02:14,930 activate 100days, awesome. 37 00:02:14,930 --> 00:02:17,400 And now, I can open up our Jupyter server. 38 00:02:17,400 --> 00:02:20,240 So I'll say jupyter notebook. 39 00:02:22,890 --> 00:02:29,232 And that popped open a brand-new window, which I'll bring over here to us. 40 00:02:29,232 --> 00:02:35,488 And I'm going to choose, over here, this New., we'll do new Python 3 notebook. 41 00:02:35,488 --> 00:02:39,926 And I'm gonna come up here and I'm going to 42 00:02:39,926 --> 00:02:44,744 rename this to introduction to NumPy, okay? 43 00:02:44,744 --> 00:02:50,290 And I want this first cell here, I'm gonna make this first cell Markdown. 44 00:02:50,290 --> 00:02:55,082 And I'm gonna write heading one of introduction to Numpy, and 45 00:02:55,082 --> 00:02:58,050 I will just say learning Numpy. 46 00:02:59,530 --> 00:03:02,778 So I'd like to repeat that I'd love for you to follow along and 47 00:03:02,778 --> 00:03:04,094 make your own notebook. 48 00:03:04,094 --> 00:03:07,848 I'll give you mine when the course is over so you can have all of my notes, but 49 00:03:07,848 --> 00:03:09,970 please feel free to make your own comment. 50 00:03:09,970 --> 00:03:11,559 I find that when using these notebooks, 51 00:03:11,559 --> 00:03:13,940 it helps to capture your thoughts to review later. 52 00:03:13,940 --> 00:03:16,595 I really liked using these for cheat sheets. 53 00:03:16,595 --> 00:03:18,807 So we can actually run this cell and 54 00:03:18,807 --> 00:03:22,176 enter the next one by choosing option enter on a Mac. 55 00:03:22,176 --> 00:03:23,940 So option enter. 56 00:03:23,940 --> 00:03:26,497 Just a quick heads up, I love keyboard shortcuts, 57 00:03:26,497 --> 00:03:29,620 you can pick up some great productivity by learning them. 58 00:03:29,620 --> 00:03:34,990 So, open the list here, and kinda type what it was that you were looking to do. 59 00:03:34,990 --> 00:03:36,310 So we were looking to run that cell. 60 00:03:36,310 --> 00:03:40,610 So if I type run, and we'll see here we have run cell and insert below. 61 00:03:40,610 --> 00:03:42,230 That's what I did, so this is option enter, 62 00:03:42,230 --> 00:03:44,850 this'll look different if you're running this on Windows. 63 00:03:44,850 --> 00:03:46,460 Pretty cool, right? 64 00:03:46,460 --> 00:03:50,480 Okay, so the new cell that was created here is Python by default, all right? 65 00:03:50,480 --> 00:03:51,970 So it's code. 66 00:03:51,970 --> 00:03:54,290 I wanna make sure that we got things installed correctly, so 67 00:03:54,290 --> 00:03:57,260 what I'm gonna do is I'm going to import NumPy. 68 00:03:57,260 --> 00:04:01,560 Now, as it turns out, data scientists are just as lazy as programmers and 69 00:04:01,560 --> 00:04:04,450 don't like typing more than we need to. 70 00:04:04,450 --> 00:04:09,100 So, a very common way to use NumPy is to import it as NP. 71 00:04:09,100 --> 00:04:15,950 So, you say Import numpy as np. 72 00:04:15,950 --> 00:04:19,000 And that will allow you to skip some unnecessary characters, 73 00:04:19,000 --> 00:04:21,015 we don't wanna type more than we need to. 74 00:04:21,015 --> 00:04:26,070 Well, of course, that stands for NumPy, but I like to think of it as no problem. 75 00:04:27,340 --> 00:04:31,740 And that's because when we're done here, NumPy will be no problem. 76 00:04:31,740 --> 00:04:36,094 Like most great libraries, the NumPy module exposes its dunder version. 77 00:04:36,094 --> 00:04:38,487 So we'll just write that here, let's put that in the same cell here. 78 00:04:38,487 --> 00:04:41,668 We'll say, np.__verson__. 79 00:04:41,668 --> 00:04:46,308 And remember in Jupiter notebooks, when you run a cell, the last line, 80 00:04:46,308 --> 00:04:47,919 it will show its output. 81 00:04:47,919 --> 00:04:53,505 So here we go, and you'll see that I'm running 1.14.5. 82 00:04:53,505 --> 00:04:56,619 Now, you are most likely using a more current version than I am. 83 00:04:56,619 --> 00:04:58,476 And there shouldn't be any breaking changes for 84 00:04:58,476 --> 00:05:00,160 this course between your version and mine. 85 00:05:00,160 --> 00:05:04,220 With that said, I can't predict the future yet. 86 00:05:04,220 --> 00:05:05,180 So, therefore, 87 00:05:05,180 --> 00:05:09,240 if there are any problems, I'll makes sure to list those in the teacher's notes. 88 00:05:09,240 --> 00:05:12,120 So please, take a moment right now to check those out, 89 00:05:12,120 --> 00:05:13,690 I don't want you to have any problems. 90 00:05:13,690 --> 00:05:18,320 I want you to have no problem, np, with NumPy, np. 91 00:05:18,320 --> 00:05:21,370 Alright, now that we have our environment all set up correctly, 92 00:05:21,370 --> 00:05:26,120 let's dive into learning the most critical data structure of NumPy, the array.