Welcome, in this video, we will introduce you to Jupyter Lab which is an environment
that allows you to easily edit and organize Jupyter Notebooks.
Now you are going to hear the terms Jupyter Lab and Jupyter Notebook alot.
So just to clarify here when I am talkinag about Jupyter notebook I am referring to the
actual whole file when I am talking about Jupyter Lab then that is the environment that
organizes the various Jupyter Notebooks that allows me to run them.
You'll also learn to upload data into Jupyter Lab, create your first Jupyter Notebook, run
some code, and add some text and images.
When you open up Jupyter Lab for the first time, you will see that on the left hand side,
you have a files directory where you can keep track of all of your files in a larger screen
on the right hand side.
From this launcher you can create new Jupyter Notebooks currently available in Python 3,
Scala or R. Other options for more intermediate users to explore like coding directly, in
a console, using terminal or writing new code in your text editor.
On CCLabs there are other features like Cognos dashboard embedded for Data Visualization
and some sample Jupyter Notebook tutorials on the bottom.
For this video, we'll just focus on the Jupyter Notebooks.
Ok.
Lets 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 plus 1 and then on your keyboard, press
shift, enter which executes the code using Python and that returns 2.
Now we can create even more cells by pressing the plus (+) button on the top and write more
code like setting "X" to be equal to the integer 1 and printing the output of "X" in the cell
below
which allows you 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 dropdown menu and now if you type in something like
1 plus 1 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 the cell.
Now it is called markdown because it is actually a kind of syntax that allow you to stylize
your text for example you can create titles or headers by using the # 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 embed an image, you can use the image source tag to embed the image.
Now I want to show you on Jupyter Lab 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 folders to organize all your files, especially if you are going to
be working with lots of notebooks or datafiles.
For .CSV files you can even double click on the file to open up a preview of it's contents
which is really nice.
You can't really do much other than view the contents however, so if you want to add, analyze
or manipulate the data, that is when you want to use Python, R or Scala.
Lets create a new notebook running Python 3.
To import a .CSV file in Python, we need to use a ReadCSV function from the Pandas Library,
so the first step is to import Pandas SPD.
Next you can read in the file using the file path to your .CSV file and lets assign it
to a variable called DF.
Now if you print the head of DF it should show us the first 5 rows of the .CSV file.
So now that you have learned how to write and execute codes using 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 have enjoyed learning how to upload and import data in Jupyter Lab.