Welcome, in this video we'll introduce you to JupyterLab which is
an environment that allows you to easily edit and organize Jupyter Notebooks.
Now you're going to hear the terms JupyterLab and Jupyter Notebook a lot.
So just to clarify here,
when I'm talking about Jupyter Notebook, I'm referring to the actual file.
When I'm talking about JupyterLab, then that's the environment that organizes my
various Jupyter Notebooks that allows me to run them.
You also learn how to upload data into JupyterLab,
create your first Jupyter Notebook, run some code, and add some text and images.
When you open up JupyterLab for the first time,
you'll see that on the left hand side you have your files directory, where you can
keep track of all of your files and a launcher screen on the right hand side.
From this launcher, you can create new Jupyter notebooks currently available
in Python 3, Scala, or R.
And there's some other options for more intermediate users to explore, by coding
directly in the console using terminal or writing your code in a text editor.
On CC labs, there are other features like Cognose Dashboard embedded for
data visualization and some sample Jupyter Notebook tutorials at the bottom.
For this video, we'll just focus on the Jupyter Notebooks.
Okay, let's first create a notebook in Python 3, and
then we can dive into how to use Jupyter Notebooks.
Jupyter Notebooks are made up entirely of cells.
So you can see in this notebook, there is currently one cell.
Let's type something inside the cell, like 1 + 1 and then on your keyboard press
Shift+Enter, which executes the code using Python, and that returns two.
Now we can create even more cells by pressing the Plus button at the top, and
write more code, like setting X to be equal to the integer one, and
printing the output of X in the cell below.
So all of these cells are actually what are called code cells, which allow me to
run code using the interpreter which in this case is Python 3.
But how do we add titles or text to our notebook?
Well, you will first need to convert the cell type from code into a markdown
cell by clicking on a cell choosing markdown from the drop down menu.
And now if you type in something like one plus one into this markdown cell and
try to run it using Shift + Enter, it gets converted directly into text.
And to edit it again, simply double-click on a cell.
Now it's called markdown because it's actually a kind of syntax
that allows you to stylize your text.
For example, you can create titles or headers by using the pound symbol and
a space followed by some text like My Title.
There are other ways to stylize your text as well.
And here are some examples.
But I encourage you to look up a markdown formatting guide
to find out all the different ways you can format your text.
In markdown cells, you can also use HTML as well.
For example, if you want to embed an image,
you can use the image source tag to embed an image.
Now, I want to show you on JupyterLab,
how to import data like a CSV file and use it in a Jupyter notebook.
To import data, you can simply drag and
drop your data file directly into the files directory on the left hand side.
Once the upload is complete, it will show in the directory.
And it doesn't have to be CSV, it could be any file type.
You can also create different folders to organize all of your files,
especially if you're going to be working with lots of notebooks or data files.
For CSV files, you can even double click on the file to
open up a preview of its contents, which is really nice, but
you can't really do much other than view the contents however.
So if you want to analyze or manipulate the data,
that's when you want to use Python, R, or Scala.
Let's create a new notebook running Python 3.
To important a CSV file in Python,
we need to use a read CSV function from the pandas library.
So the first step is to import pandas as PD.
Next, you can read in the file using the file path to your CSV file, and
let's assign it to a variable called DF.
Now if you print the head of DF,
it should show us the first five rows of the CSV file.
So now you've learned how to write and execute code in a Jupyter notebook and
how to add text, format it, and embed images.
Learning how to analyze and
manipulate the data is a bit out of the scope of this video, but
hopefully you've enjoyed learning how to upload and import data in JupyterLab.