diff options
| author | Christian Kolset <christian.kolset@gmail.com> | 2025-04-28 11:41:51 -0600 |
|---|---|---|
| committer | Christian Kolset <christian.kolset@gmail.com> | 2025-04-28 11:41:51 -0600 |
| commit | f1cc185b2571715b3077c9ea8ed601940a8f4932 (patch) | |
| tree | b2793dcc95f789ea43fcf406501a4680d46bc01f /tutorials/module_1/jupyter_lab_notebook.ipynb | |
| parent | 8216a16d78d7aff5bc5a1607694ec3ea24eef64f (diff) | |
notebook files in module 1. Added content
Diffstat (limited to 'tutorials/module_1/jupyter_lab_notebook.ipynb')
| -rw-r--r-- | tutorials/module_1/jupyter_lab_notebook.ipynb | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/tutorials/module_1/jupyter_lab_notebook.ipynb b/tutorials/module_1/jupyter_lab_notebook.ipynb new file mode 100644 index 0000000..20b297c --- /dev/null +++ b/tutorials/module_1/jupyter_lab_notebook.ipynb @@ -0,0 +1,131 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "3895c65a-b923-4c86-94a4-a43dfb09eeab", + "metadata": {}, + "source": [ + "## Introduction\n", + "\n", + "Jupyter Notebooks are often used for data science and scientific\n", + "computing such as machine learning as the interactive design allow you\n", + "to experiment easily with your code. For our purpose, we will use\n", + "Notebooks as it’s a useful tool to learn how to code as well as writing\n", + "reports.\n", + "\n", + "*Note on the difference between Notebook and Lab: Jupyter Notebook\n", + "offers a simplified, lightweight notebook authoring experience, where\n", + "as, JupyterLab offers a feature-rich, tabbed multi-notebook editing\n", + "environment with additional tools like a customizable interface layout\n", + "and system console*\n", + "\n", + "## Setup and Installation\n", + "\n", + "Jupyter Notebooks can be installed either from the Anaconda Navigator\n", + "home page or directly from your Conda terminal.\n", + "\n", + "Terminal: `conda install conda-forge::jupyterlab`\n", + "\n", + "## Notebook Basics\n", + "\n", + "- Creating a new notebook (`.ipynb`)\n", + "- Types of cells:\n", + " - Code\n", + " - Markdown\n", + " - Raw\n", + "- Running a cell: `Shift + Enter`\n", + "- Adding/removing cells\n", + "- Restarting the kernel\n", + "- Saving and auto-checkpoints\n", + "\n", + "Jupyter Notebooks are files which allows you to combine *Code* and\n", + "*Markdown* cells in one single document. The code cells, allow you to\n", + "interactively run python code and print and plot data in your document.\n", + "If you wish to update or change data your code you can re-run the cell\n", + "to update the output. The markdown cells allows you to write text,\n", + "titles and insert images in your documentation using the markup language\n", + "*Markdown*.\n", + "\n", + "## Writing and Running Code\n", + "\n", + "- Python syntax: - `print(\"Hello, world!\")` - Variables and\n", + " functions - Loops and conditionals\n", + "- Importing libraries: - `import numpy as np` -\n", + " `import pandas as pd` - `import matplotlib.pyplot as plt`\n", + "\n", + "## Using Markdown\n", + "\n", + "- Headers: `#`, `##`, `###`\n", + "- Bullet lists: `- item`\n", + "- Numbered lists: `1. item`\n", + "- Emphasis: *italic*, **bold**, `monospace`\n", + "- LaTeX equations:\n", + " - Inline: `$E = mc^2$`\n", + " - Block: `$$\\int_0^\\infty e^{-x^2} dx = \\frac{\\sqrt{\\pi}}{2}$$`\n", + "- Embedding links and images\n", + "\n", + "## Interactive Widgets (optional)\n", + "\n", + "Install `ipywidgets` from your package manager\n", + "\n", + "``` python\n", + "import ipywidgets as widgets\n", + "widgets.IntSlider()\n", + "```\n", + "\n", + "Example using interact:\n", + "\n", + "``` python\n", + "from ipywidgets import interact\n", + "interact(lambda x: x**2, x=5)\n", + "```\n", + "\n", + "## Productivity Tips\n", + "\n", + "Here are some keyboard shortcuts to improve your productivity when\n", + "writing in notebooks.\n", + "\n", + "| Key | Action |\n", + "|-----|--------------------|\n", + "| A | insert cell above |\n", + "| B | insert cell below |\n", + "| M | switch to Markdown |\n", + "| Y | switch to code |\n", + "\n", + "Magic commands: - `%timeit`, `%matplotlib inline`, `%%bash` Splitting\n", + "and merging cells Auto-save behavior\n", + "\n", + "## Exporting and Sharing\n", + "\n", + "- File \\> Download As:\n", + " - Notebook (`.ipynb`)\n", + " - HTML\n", + " - PDF (requires LaTeX)\n", + " - Markdown\n", + "- Notebooks can be saved and shared via the following services: -\n", + " GitHub - nbviewer.org - mybinder.org - JupyterHub" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "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.13.2" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} |
