Home and Learn: Data Analysis
A Jupyter Notebook is a great way to run Python and Pandas code as it means you don't have to install an IDE. In the previous lesson, we installed Jupyter on Windows. But the only reason we did so was because we'll need to load up some local datasets for this Pandas course. You can actually use the online of Jupyter version here (Jupyter Notebook link):
We have a Python course for beginners here:
You can do a lot of the course through the Jupyter website, rather than installing PyCharm.
Let's see how Jupyter Notebooks work, though.
Using your knowledge from the previous lesson, launch the Jupyter homepage. You should be looking at this:

On the left, you'll see a list of folders, files and any Notebooks you create. Once you create a Notebook, you can reopen it by simply clicking its link on the left.
Top right of the homepage, click the button that says New. You'll see a dropdown list:

Click on the Folder item. It might look like nothing has happened, but you should see a folder called Untitled Folder has been added to the list on the left. Select the folder by checking the box next to it. You'll see some icons appear top left:

Click the Rename button. Name your folder Tutorials.
Click on the newly-renamed folder to be taken inside of it:

Click on the New button again. From the menu, select the Python item:

Creating a new Python file will launch it in a new browser tab. It should look like this:

Notice that it says Untitled at the top. Left-click on the word Untitled and you'll see this box appear:

Type a new name for your Python file and click the Rename button. You should see your new title appear at the top in place of Untitled.
Click back on the Tutorials tab for a moment. You'll see your new Notebook in the folder:

If you accidentally close down your Getting Started tab, click on it here to reopen it.
Click back on your Getting Started tab. Let's add some code and run it.
Code in Jupyter Notebooks is added to cells. Cells are the grey areas that say In to the left of them. This is where you write your code.
Click inside of the cell. Add the following:
greeting = 'Hello Pandas!'
greeting
It should look like this:

To see the output of your code, you need to click the Run button, highlighted by a red arrow in the image above:

Our Hello Pandas message is output below the cell. Notice that a new cell gets added whenever you Run your code.
You can add Python functions to cells and run them from another cell. To clarify this, add the following Python function to the cell below the first one:
def greetMe(myName):
return 'Welcome to the lesson, ' + myName

With your cursor inside of the greetMe function, click the Run button again. The only thing that will happen is that a new cell appears below the function. Add this in the empty cell:
greetMe('Kenny')

Run the third cell and you should see something like this output:

You can cut cells, if you don't want them. Click inside the new empty cell. Type this:
'Cut this'
From then menu at the top, select Edit > Cut Cells. (Or just click the scissors icon.)

The cell should disappear.
To get a new cell, click inside cell 3, the one with the greetMe('Kenny') in it. From the Insert menu at the top of Jupyter, click Insert > Cell Below:

You'll get a new cell:

OK, that's about it for this lesson. There's not much else to a Jupyter Notebook - they are pretty easy and intuitive to use. Let's move on to the first lesson on Data Analysis in Pandas.
<< Install | Pandas Dataframes >>
Email us: enquiry at homeandlearn.co.uk