Mastering PyCharm Transcripts
Chapter: Data science tools
Lecture: Exploring data in notebooks

Login or purchase this course to watch this video and the rest of the course contents.
0:01 Writing code like this was really fun
0:03 and this is certainly important in data science,
0:05 but one of the premier tool sets that people use these days
0:09 when they're doing data science of course, is Jupyter notebooks,
0:12 and we'll see that PyCharm has special support for Jupyter notebooks as well.
0:16 So let's take the same bit of code
0:19 and redeploy it, revision it as a Jupyter notebook,
0:23 we'll come over here, right click and say new jupyter notebook
0:27 and I'll just call this explore as well,
0:29 and now we have right in line here a Jupyter notebook
0:34 and we can have different things, like we could have a heading,
0:38 saying this is our data exploration, great.
0:46 Now we can go and try to run it, and that works
0:50 but let's go and do some code.
0:52 We're going to work with basically the same code here
0:57 so let's come over here and do our imports,
1:03 and try to run that,
1:05 now, something maybe somewhat unexpected happens,
1:08 it says, okay, well where is the url for your running notebook server
1:12 and you're like wait, running notebook server— come on what's going on here,
1:15 I don't have a notebook server, I'm trying to get started with Jupyter.
1:18 So if you actually cancel this, it will go and propose
1:23 that the system set up and start a Jupyter notebook server for you, so let's cancel this,
1:30 it says couldn't connect do you want to try to run it.
1:32 Now remember, down here
1:37 we don't have Jupyter install
1:40 we do have some of the data science, but we don't have Jupyter,
1:43 so we'll go over here and let's do it one more time and click this
1:48 and it'll try to basically install it for us,
1:51 so it says we're going to run like this,
1:54 oh except for that we can't because it's not installed,
1:57 so you get fixed, watch this little part down here,
2:00 my window is being small for recording, it's hard to see,
2:03 but there you go, installing Jupyter.
2:09 So it's all fixed, you can see it's done,
2:12 I would actually like for this little fix warning thing to go away when that happens,
2:16 but it didn't at the moment, so we'll just hit run,
2:20 and then everything is up and running.
2:22 Now, we could use this, right, we could use this
2:25 but in fact, we can just put this section away and hit play again
2:32 and guess what, it looks like it works,
2:34 like we could try print Hello Jupyter,
2:40 it is working again, all right.
2:43 Now, let's take our code over here,
2:45 let's work on our data bit, using a few little blocks here, run that
2:52 so now we have our data all loaded up and we can do that,
3:02 and over here, notice something happened
3:04 we have our science view, and it just popped up the same graph over here
3:08 so let's go and actually make a change to say,
3:11 no in Jupyter, what we typically want is
3:14 we want our data shown in the notebook,
3:18 so let's go back to the top and
3:21 we're going to use command is directed to Jupyter, not to Python
3:25 we can use Matplotlib inline,
3:29 now it decided it has to reindex something
3:32 so this went gray for a second hold on.
3:34 Okay, so run that again, run that again,
3:37 now if we run our plot, boom, right there inline, how cool is that?
3:43 In fact, I don't even think we need this show anymore, let's see,
3:51 we don't need it, but we don't want to output that where that pointer is.
3:57 Okay so here is our same bit of code that we wrote over here,
4:00 but now we've written it in a Jupyter notebook style
4:04 and we've used the Matplotlib inline
4:07 to make it render here instead of pop up separately, pretty cool huh?
4:12 So if you're using Jupyter notebooks
4:14 this is how you do it, there's a few steps,
4:17 you sort of try it, it doesn't work, you hit a button to fix it
4:19 or you cancel on that and hit the button to fix it,
4:21 so it's a little bit of a back and forth, but it's really easy once you get it set up,
4:24 an it's even easier because it's already installed,
4:27 so very, very cool, the support they have here for this as well.