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


Talk Python's Mastodon Michael Kennedy's Mastodon