Transcription
[Music] Want to code and see your results instantly? Now imagine writing Python code and watching it run all in one place with no hassle. That's exactly what Jupyter Notebook in VS Code lets you do. Whether you're learning to code or working on a big project, this tool makes it super easy to write, test, and visualize your code all in a few clicks.
So, in this video, we are going to show you just how easy and powerful it is to use Jupyter Notebook in VS Code. And here's the best part. GitHub Copilot will be helping us code along the way. That means you don't have to worry about writing everything by yourself, and you get to see how flexible and interactive Jupyter can be.
Here's what we'll cover in today's demo. First, we'll see how to set up Jupyter Notebook in VS Code. How to start coding in Python using Jupyter. How GitHub Copilot makes coding faster and easier. The magic of working with cells, visualization, and markdown in one place. And some quick tips for debugging and exploring your variables. So, if you're excited to see how easy coding can be, let's jump right in.
Now, before we get started, here's a quick quiz question for you. What do you need to install first to get started with Jupyter in VS Code? Python, Jupyter extension, GitHub Copilot, or virtual environment? Drop your answers in the comment section below. I'm curious to see who gets it right. And if you're enjoying the video, make sure to hit the like button, share with your friends, and don't forget to subscribe. Also, click that notification bell so you never miss out on our awesome tutorials here at SimplyLearn. So, let's get started.
Now before we move on, imagine transforming your career with one of our hottest skills today. Data science and generative AI ranked number one. Data science program by Economic Times. The professional certificate in data science and generative AI from Purdue University and SimplyLearn equips you with hands-on learning in Python, machine learning, deep learning, and generative AI tools like ChatGPT with masterclasses from Purdue University and IBM experts, plus real-world projects. This six-month program opens doors to high-demand roles across industries. You can boost your career with Purdue's world-class training. So don't miss out. Start your journey right now. You can find the link in the description box below.
So, let's get started with the installation part. Make sure that you have VS Code already installed in your system. Now, we all know that VS Code supports working with Jupyter Notebook natively. So, it's incredibly seamless to get started. In VS Code, you need to head over to the extension view from here. And then you need to search for Jupyter. Click on the first link from here, and then you have to just select install, and this will automatically install your Jupyter.
Okay, so now my Jupyter extension is installed. Now, if this is the first time you've ever installed the Jupyter extension, you will see a welcome experience for getting started with Jupyter Notebook. Now, this tool will walk you through all the steps to create your first notebook, following the same workflow as we will be showing in a demo video. Now, you can always navigate back to your welcome experience by just entering this command, which is welcome walkthrough. So we'll just search for walkthrough, open walkthrough, and getting started with Jupyter. So here we have our welcome experience of Jupyter notebook.
Now, you will also need to install this one more extension, which is necessary for connecting the Python environment. So we'll just search for Python extension from here, and then we'll just hit on this install button from here, and we'll wait till our Python is installed. So now it's this extension has already been installed. Now, this extension provides language features like IntelliSense and syntax highlighting.
Now, the next step we'll be talking about is setting up our environment. So let's get started and create our first notebook in the command palette, and then we'll just type here create, create new Jupyter notebook. So this is the command we'll be entering, and this will open a blank notebook file, which you can then save, open, and edit just like any other file. So let's save it. Now we'll just click on Ctrl+S and we'll save the file as my first Jupyter notebook. All right. And we'll just click on enter.
Now, there's one more step before you can start running your notebook, and that's connecting to the kernel. Now, this kernel is essentially the computational engine for executing your code. So in the top right, you can just click on select kernel from here, and then you will see a drop-down list from here, which you need to just select on Python environments. Now, if you have already Python installed, click on create Python environment. Since I have my Python already installed, I have my Python directory, which is the Python 3.12.10, and I'll just click on that. You can also create a lightweight virtual environment using Python. We have an entire video about getting started with Python, a full course. I'll attach that in the card section below. So, you can definitely check that out. One more quick information, Anaconda is also a popular choice for creating a virtual environment, and we will link to that documentation in the video description.
So now that we have a kernel to execute the code, let's run a simple code cell. And I will just write a basic code, which is the hello world. And I'll just type in print hello world. All right, there's a lot of space here. So I'll just remove that space. And then I'll just run this code by clicking on the play button from here. And you can see that my output is being generated. Hello world. You can also use the keyboard shortcut, which is the Ctrl+Alt+Enter keyboard shortcut. Now we have running code in our notebook. And that's all the setup you need to do.
The third step is running text, code, and visuals in one notebook. Let's explore this notebook a little more. So in the top left of the Jupyter toolbar, you can just create a code or markdown cell. From here, you can add a markdown cell. Now, you can also see these action buttons appearing here as markdown, code, and generate if you hover directly below or above the existing cell in your notebook. Now, each cell has a language drop-down in the bottom right corner. So you can use it to change the language. So I'll show you. So we have already selected our Python language from here. But you can also, you know, click on the other languages, which is the XML, MSSQL, shell script, Ruby, PowerShell, and many more. So we have multiple options for the language selection option from here. Now, since we are coding in Python, we have selected Python for now.
Now, talking about these markdown cells. So yeah, of course, markdown cells are very helpful for separating and describing different sections of the code. Let's suppose I have this section one mentioned over here, and I'll just click on the right button. So this is my first section, and inside this section, I can also have multiple other sections. Let's suppose this is a nested section here, and again, I'll just click on it. So you see we have a nested section inside section one, and then again, I can create one more section as section two. Okay. Now, for example, in the outline view of the section, I'll show you right from here. So you have this outline view from here, and when you click on it, you can just directly click on the particular section you want to access. So this is our first section, our nested section, and our section two. Now, this makes our VS Code working in Python more flexible to use. Also, it will help you to quickly view and jump to different sections of the notebook. You can think of it just like a table of contents. You can then delete also a cell by clicking this trash icon from here. Let's suppose I've deleted the section two. So I'll be selecting this particular cell and I'll just click on this. So our section two is being now deleted.
Let's get into the interesting part and do some coding, that is, using the GitHub Copilot now. So this is our GitHub Copilot, and we will be using the agent mode. So I will ask GitHub Copilot to generate a sample data. So from here, I can also just click on the start voice chat. Create a sample dataset for me showing different products and the price and stock. Okay. So I've given my agent the prompt. So I'll just insert this in my notebook, and you can see that my data here's a quick sample dataset for our products, including product name, price, and the stock quantity. You can use this in your Jupyter notebook as a Pandas DataFrame. So we have all our data listed over here.
Now, if you want to have some sort of visuals in your notebook, you can also use that. So again, I'll be giving one more prompt. I want to have some sort of visual in our notebook. Let's import the Matplotlib package and create a scatter plot showing the relationship between the stock and the price of the product. So I've given my prompt here now to add Matplotlib package and create a scatter plot. Let's see how it does. So it says that a new code cell has been added in our notebook that imports Matplotlib and creates a scatter plot. All right. So this is our code cell already being added to our notebook. Now, what we need to do is we need to run this code cell. You can either run it one by one, or you can also run it in one go. Let's suppose I want to run this particular code cell. So I'll just hit on the play button, and now I'll show you the results being generated. So you can see that my table has been listed here as product, price, and stock, which is laptop, smartphone, headphones, monitor, and keyboard. So again, I'll be running this particular code cell. So I'll be hitting on the play icon from here, and as you can see that my scatter plot is now ready, which shows product price versus stock quantity. You could also run these particular code cells in one go using this run all from here.
And if you want to interrupt, you can also do that in between. So when I run this and I interrupt in between, you can notice one thing from here, which is the breakpoint, right? So you can click to add a breakpoint from here, and then you can select and debug this cell in the run action again from here.
Now, one final feature which I want to show you guys is the Jupyter variables. So I'll just click on this Jupyter variables, and let me just make it in the full-size view. Now you can see the list of all the variables we have used in our code. Now we have variable names as data, df, DataFrame, text, and I, and the type is integer, DataFrame, and all the size and the value. Now, when you click on this pop-up icon from here, you'll be then shown recommended extensions for viewing the data. So first, you have to just select yes from here, and the recommended extension is the Data Wrangler. Now, if you choose to install that, you will have a really easy way to further view and analyze your data. So again, you can install your Data Wrangler from here, and you can, you know, move ahead with your data, any particular data you want to just deep dive into.
Now, with that, we have come to the end of our tutorial today. Now, if you're ready to dive deeper into Python and level up your coding skills, then this is the place for you. Want to code faster and smarter? Don't forget to hit that subscribe button and click the bell icon so you never miss out on our latest tutorials and tech insights. We are here to help you nerd up and get certified, one line of code at a time. Drop your thoughts and any questions you have in the comment section below. We would love to hear from you. See you in the next video and happy coding.
Hi there. If you like this video, subscribe to SimplyLearn YouTube channel and click here to watch similar videos. To nerd up and get certified, you can check the description box below.