This tutorial describes step by step how to setup Jupyter Lab for Python 3.
Click on the latest version (Python 3.9) for your operating system (e.g., Miniconda3 Windows 64-bit) to download the installer.
Run the Miniconda3 installer (shown here is the installer for Windows 10) by following these steps.
Click Next.
Click I Agree. Click Next. Click Next.IMPORTANT, select the option "Add Miniconda 3 to my PATH environment Variable" and click "Install"
Click Next.Finally, click finish to complete the installation of Miniconda3.
In a terminal window download the Miniconda install script.
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
Install Miniconda by running the downloaded script.
bash Miniconda3-latest-Linux-x86_64.sh
Follow the prompts on the installer screens. If you are unsure about any setting, accept the defaults.
To make the changes take effect, close and then re-open your terminal window.
Test the installation.
conda list
A list of installed packages appears if it has been installed correctly.
Type "cmd" in the Windows search bar to open a command window.
Type "terminal" in the Spotlight Search in top menu bar to open a terminal window.
Open a terminal window.
Type the following command into the command window to install Jupyter Lab.
conda install -c conda-forge jupyterlab
Type "y" to proceed when prompted to complete the installation.
Type the following command into the command window to install Pandas.
conda install -c conda-forge pandas
Type "y" to proceed when prompted to complete the installation.
Type the following command into the command window to create a new directory.
mkdir tutorial
Type the following commands to run Jupyter Lab in the tutorial directory.
cd tutorial
jupyter lab
Jupyter Lab will launch in your default web browser.
Select "New -> Notebook" from the File menu.
Select "Python 3" as the Kernel.
Select "Rename" from the file menu and rename the notebook: tutorial1.ipynb
.
Type print('Hello World')
in the first notebook cell.
Click the run (>) button to execute your first Python command. Make sure the cell you want run is selected. This command will print the text Hello World
.
Lets add a couple of numbers and print the results. In the second cell, type:
x = 5
y = 7
z = x + y
print(z)
and click the run (>) button again to see the result.
Congratulations, you've run your first Python code in Jupyter Lab.
Select "Shutdown" from the File menu when you are finshed with your first tutorial.
To start Jupyter Lab again, go to step 6, create new notebooks and follow the same steps.
Now you are ready to learn Python!
Now, that you have setup Python and Jupyter Notebook, let's learn the basics of Python. Corey Schafer has created an excellent series of YouTube videos.
Run these tutorials in Jupyter Notebooks. Create a new notebook for each tutorial (tutorial2, tutorial3,...).
For each new topic in a tutorial, create a new cell by clicking the +
sign in the menu at the top of the notebook.
-
Python Tutorial for Beginners 2: Strings - Working with Textual Data
-
Python Tutorial for Beginners 3: Integers and Floats - Working with Numeric Data
-
Python Tutorial for Beginners 4: Lists, Tuples, and Sets
-
Python Tutorial for Beginners 5: Dictionaries - Working with Key-Value Pairs
-
Python Tutorial for Beginners 6: Conditionals and Booleans - If, Else, and Elif Statements
-
Python Tutorial for Beginners 7: Loops and Iterations - For/While Loops
Pandas is a Python library for data analysis. It works with tabular data, such as Excel files (.xlsx) or comma separated value files (.csv). Pandas refers to tabular data as dataframes.
Run the tutorials in Jupyter Lab.
NOTE, We'll skip the first 3 minutes of the first video which covers the installation of Pandas and Jupyter Lab. You have already installed them earlier, so do not install them again. We'll start the video with loading data into Pandas
-
Python Pandas Tutorial (Part 1): Getting Started with Data Analysis -
Installation andLoading Data
The data files used in this video can be downloaded from the StackOverflow Survey download page -
Python Pandas Tutorial (Part 2):DataFrame and Series Basics - Selecting Rows and Columns
-
Python Pandas Tutorial (Part 3): Indexes - How to Set, Reset, and Use Indexes