-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
174 additions
and
1 deletion.
There are no files selected for viewing
173 changes: 173 additions & 0 deletions
173
APSToolkitPython/Tutorials/00. Jupyter Notebook And Python.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Introduction" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Jupyter Notebook\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations, and narrative text. It's widely used for data cleaning and transformation, numerical simulation, statistical modeling, data visualization, machine learning, and much more.\n", | ||
"\n", | ||
"The name \"Jupyter\" is an acronym which stands for the three programming languages that it was designed for: Julia, Python, and R. However, today, the notebook technology supports many more languages.\n", | ||
"\n", | ||
"Python is one of the most popular languages used in Jupyter Notebooks. Python is a high-level, interpreted programming language known for its readability and versatility. It's widely used in scientific computing, data analysis, artificial intelligence, web development, and automation.\n", | ||
"\n", | ||
"In a Python Jupyter Notebook, you can write and execute Python code in individual cells. You can also include text, images, and other media in Markdown cells to create a complete computational narrative. The ability to mix code with rich text elements makes Jupyter Notebook an ideal tool for teaching and learning programming, as well as for performing data analysis and visualization." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Installing Jupyter Notebook with Visual Studio Code" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Here's a step-by-step guide on how to install Jupyter Notebook with Visual Studio Code:\n", | ||
"\n", | ||
"1. **Install Python and pip**: Before you can use Jupyter Notebooks in Visual Studio Code, you need to have Python and pip, the Python package installer, installed on your computer. If you don't have them installed, you can download Python from the official website (https://www.python.org/downloads/). Pip is included with Python.\n", | ||
"\n", | ||
"2. **Install Jupyter Notebook**: Once you have Python and pip installed, you can install Jupyter Notebook by opening a terminal and running the following command: `pip install notebook`.\n", | ||
"\n", | ||
"3. **Install Visual Studio Code**: If you haven't already, download and install Visual Studio Code from the official website (https://code.visualstudio.com/download).\n", | ||
"\n", | ||
"4. **Install the Python extension for Visual Studio Code**: Open Visual Studio Code, go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of the window. In the Extensions view, search for \"python\" and install the Python extension by Microsoft.\n", | ||
"\n", | ||
"5. **Open a Jupyter Notebook in Visual Studio Code**: You can now open a Jupyter Notebook in Visual Studio Code. To do this, go to the File menu, select Open File, and choose your .ipynb file. You can also create a new Jupyter Notebook by going to the File menu, selecting New File, and then changing the language of the file to \"Jupyter\" by clicking on the language indicator in the bottom right corner of the window and selecting \"Jupyter\".\n", | ||
"\n", | ||
"6. **Run a Jupyter Notebook**: To run a cell in the Jupyter Notebook, click on the cell to select it, then press the \"Run Cell\" button in the top menu. You can also use the keyboard shortcut `Shift + Enter` to run the current cell and select the next one.\n", | ||
"\n", | ||
"Remember to save your work frequently by pressing `Ctrl + S` or by going to the File menu and selecting Save." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## Getting Started with Jupyter Notebook" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Write and Execute Code" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Hello, Jupyter Notebook!\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"print(\"Hello, Jupyter Notebook!\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Install APS-Toolkit Library" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Now, let'ts try install `aps-toolkit` library by use the `%pip install aps-toolkit --upgrade` command in a Jupyter Notebook:\n", | ||
"\n", | ||
"1. **Open Jupyter Notebook**: Start by launching Jupyter Notebook. You can do this by typing `jupyter notebook` in your terminal or command prompt, which should open a new tab in your default web browser with the Jupyter Notebook interface.\n", | ||
"\n", | ||
"2. **Create a New Notebook**: In the Jupyter Notebook interface, click on the \"New\" button (usually located in the top-right corner) and select \"Python 3\" (or the version of Python you have installed) to create a new notebook.\n", | ||
"\n", | ||
"3. **Enter the Command**: In your new notebook, you'll see a cell where you can write code. Click on this cell to select it, then type the command `%pip install aps-toolkit --upgrade` and press `Enter` to create a new line. The `%` at the start is a Jupyter Notebook specific syntax called a magic command. When used at the start of a line, it tells the notebook to treat the rest of the line as a command to be run in the system shell.\n", | ||
"\n", | ||
"4. **Run the Command**: To run the command, you can either click on the \"Run\" button in the toolbar at the top of the page, or use the keyboard shortcut `Shift + Enter`. This will execute the command in the cell, installing or upgrading the `aps-toolkit` package.\n", | ||
"\n", | ||
"5. **Check the Installation**: After running the command, you should see some output below the cell indicating that the package is being downloaded and installed. If the installation is successful, you should see a message saying \"Successfully installed aps-toolkit-...\" with the version number of the package.\n", | ||
"\n", | ||
"Remember to save your notebook regularly by clicking on the \"File\" menu and selecting \"Save and Checkpoint\"." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Requirement already satisfied: aps-toolkit in c:\\python311\\lib\\site-packages (0.0.8)\n", | ||
"Requirement already satisfied: requests in c:\\python311\\lib\\site-packages (from aps-toolkit) (2.31.0)\n", | ||
"Requirement already satisfied: pandas in c:\\python311\\lib\\site-packages (from aps-toolkit) (2.2.1)\n", | ||
"Requirement already satisfied: numpy<2,>=1.23.2 in c:\\python311\\lib\\site-packages (from pandas->aps-toolkit) (1.26.0)\n", | ||
"Requirement already satisfied: python-dateutil>=2.8.2 in c:\\python311\\lib\\site-packages (from pandas->aps-toolkit) (2.8.2)\n", | ||
"Requirement already satisfied: pytz>=2020.1 in c:\\python311\\lib\\site-packages (from pandas->aps-toolkit) (2024.1)\n", | ||
"Requirement already satisfied: tzdata>=2022.7 in c:\\python311\\lib\\site-packages (from pandas->aps-toolkit) (2024.1)\n", | ||
"Requirement already satisfied: charset-normalizer<4,>=2 in c:\\python311\\lib\\site-packages (from requests->aps-toolkit) (3.2.0)\n", | ||
"Requirement already satisfied: idna<4,>=2.5 in c:\\python311\\lib\\site-packages (from requests->aps-toolkit) (3.4)\n", | ||
"Requirement already satisfied: urllib3<3,>=1.21.1 in c:\\python311\\lib\\site-packages (from requests->aps-toolkit) (2.0.4)\n", | ||
"Requirement already satisfied: certifi>=2017.4.17 in c:\\python311\\lib\\site-packages (from requests->aps-toolkit) (2023.7.22)\n", | ||
"Requirement already satisfied: six>=1.5 in c:\\python311\\lib\\site-packages (from python-dateutil>=2.8.2->pandas->aps-toolkit) (1.16.0)\n", | ||
"Note: you may need to restart the kernel to use updated packages.\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%pip install aps-toolkit --upgrade" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Congratulations! You've successfully installed the `aps-toolkit` library in a Jupyter Notebook. You can now use the library to perform various tasks such as data analysis, visualization, and machine learning." | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.5" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters