Python Notebooks and VS Code Integration

Set up Jupyter Notebooks in VS Code with the correct Python (Anaconda) environment and required extensions to review Python and pandas skills for upcoming data visualization work.

Set up your Python development environment in Visual Studio Code with Jupyter Notebook integration to prepare for more advanced data visualization work using Dash. This article walks through configuring the necessary extensions and verifying your environment is running with Anaconda and the required kernel packages.

Key Insights

  • Ensure that the Jupyter Notebook extension by Microsoft is installed in VS Code to enable seamless interaction with .ipynb files.
  • Select the correct Python environment, such as one based on Anaconda (e.g., dvenv), and install the ipykernel package if prompted to support interactive Python execution.
  • Noble Desktop uses this setup process to transition from introductory Dash concepts to more advanced Python, pandas, and data visualization skills.

This lesson is a preview from our Data Analytics Certificate Online (includes software). Enroll in this course for detailed lessons, live instructor support, and project-based training.

In section two of this course, we're gonna do a little bit of work in Python notebooks to make sure that we have reviewed Python, some basic Python skills, some basic Panda skills, and make sure that we're up for the rest of this course. Now, the first section that we just finished was getting to know Dash. It didn't require a lot of in-depth Pandas or Python work.

We're gonna be using some more advanced tools. We showed you how cool Dash was, how it talks about data visualization. Now it's time to do some more advanced work, and we wanna make sure that you're ready for that.

So, we have here a file in our notebook2 folder called notebook2.ipynb. Now, you should be familiar with Jupyter Notebooks. They are in every course we've taught, pretty much, on Python. And they are just everywhere in the Python world, particularly in education.

However, you might not be familiar with using them in VS Code, so we're gonna do a really quick rundown of that. And mostly what we need to do is just make sure that we have VS Code's Jupyter Notebook extension. So, if your file doesn't quite look like this, you probably don't have the Jupyter Notebook extension.

Let's go over to the Extensions section over here on the left. So, we've been playing around with the File Explorer, but if you put your cursor over these boxes with the other box joining them, it's the Extensions tab. Click on that, a lot of great extensions you could play around with.

VS Code, again, is extremely extensible, but we would just want the Jupyter Notebook one. And you want the one by Microsoft. And when you click on this, it should say Install.

Over here, mine says Uninstall because it is, of course, already installed. It also should say Install over here where the cursor is now. Install that, and if you need to, open notebook2.ipynb again, and you should be all ready to go with Jupyter Notebook here.

But we could test it out really quickly. One thing we'd like to do is to make sure that your Python version running in the background is Anaconda. So, let's write some very quick Python print hello, and you can click Execute here, or Run, Execute Cell.

And it will ask you to choose a Python environment or a kernel source, rather. We want a Python environment, so click on Python Environments, and then we can actually choose one of our Python environments, and we have this dvenv here. And it should say next to it, the Python version starts at 3.9, and it should say Anaconda 3 next to it.

Click on dvenv, and now this kernel is running with dvenv, oh, and check it out. It looks like I'm missing an extension. That's useful to know, and useful for you to see us install.

Running cells with dvenv, the environment we made, requires the ipy kernel package. Ipy is, of course, interactive Python, the original name of Jupyter Notebook, so it has a kernel package. Let's give it a shot.

Let's click Install. This is new. That's okay.

Setup always changes, and we roll with it. If this doesn't work, I'll rerecord this video. I'll learn what does work, and make sure the setup is right for you.

But I bet this'll work, because here's the great thing about VS Code, it's fantastic at making sure that your workflow isn't interrupted by some kind of error. It's very good at, like, hey, you're doing this, you probably need this extension. Okay.

It's connecting to the kernel, and it ran it. And we have hello right here. Great.

So you want to, again, you want to make sure when you click on Execute that it runs. And if it asks you to choose an environment, you want the dvenv one. And if it asks you further to install ipy kernel, do that thing.

Install it. All right, now that we're all set up with this, we're going to push forward and work on our Python, pandas, and data visualization skills, make sure we're ready to move forward.

How to Learn Python

Build practical programming skills with hands-on Python training. Python is a widely used, versatile programming language applied across data analysis, automation, artificial intelligence, and software development.

Yelp Facebook LinkedIn YouTube Twitter Instagram