|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": {}, |
| 6 | + "source": [ |
| 7 | + "# Jupyter Notebooks\n", |
| 8 | + "Jupyter Notebooks are web applications that lets us combine pieces of executable code, text, images, and visualizations in a single document, or notebook. We have installed a Jupyter Extension that lets us run notebooks directly in Visual Studio Code (VS Code)." |
| 9 | + ] |
| 10 | + }, |
| 11 | + { |
| 12 | + "cell_type": "markdown", |
| 13 | + "metadata": {}, |
| 14 | + "source": [ |
| 15 | + "Sections of a notebook are called cells. Cells can be run independently of each other, and in any order." |
| 16 | + ] |
| 17 | + }, |
| 18 | + { |
| 19 | + "cell_type": "markdown", |
| 20 | + "metadata": {}, |
| 21 | + "source": [ |
| 22 | + "## Adding text\n", |
| 23 | + "\n", |
| 24 | + "Notebooks use markdown, a markup language, for formatting text. IBM publishes a [Jupyter-specific markdown cheat sheet](https://www.ibm.com/docs/en/watson-studio-local/1.2.3?topic=notebooks-markdown-jupyter-cheatsheet).\n", |
| 25 | + "\n", |
| 26 | + "To add a text cell:\n", |
| 27 | + "1. Click **+ Markdown**\n", |
| 28 | + "2. Add some text. When you are done editing, press `ctrl` + `enter` to run the cell and format your text." |
| 29 | + ] |
| 30 | + }, |
| 31 | + { |
| 32 | + "cell_type": "markdown", |
| 33 | + "metadata": {}, |
| 34 | + "source": [ |
| 35 | + "To use VS Code with the Jupyter extension for writing and running code, follow these modified steps:\n", |
| 36 | + "\n", |
| 37 | + "## Writing and Running Code in VS Code with Jupyter Extension\n", |
| 38 | + "\n", |
| 39 | + "1. **Writing Code Cells:**\n", |
| 40 | + " - Use code cells to write your Python code. To create a new code cell, click on the `+ Code` button in the Jupyter toolbar.\n", |
| 41 | + " - Type or paste your Python code within the code cell.\n", |
| 42 | + "\n", |
| 43 | + "2. **Running Code Cells:**\n", |
| 44 | + " - To execute a code cell, you can:\n", |
| 45 | + " - Click the `Run Cell` button (a triangle icon) in the Jupyter toolbar.\n", |
| 46 | + " - Use the keyboard shortcut `Shift + Enter`.\n", |
| 47 | + " - Output, if any, will be displayed below the cell after execution.\n", |
| 48 | + "\n", |
| 49 | + "3. **Keyboard Shortcuts:**\n", |
| 50 | + " - Utilize keyboard shortcuts for faster execution:\n", |
| 51 | + " - `Shift + Enter`: Run the current cell and move to the next cell.\n", |
| 52 | + " - `Ctrl + Enter`: Run the current cell and stay on the same cell.\n", |
| 53 | + " - `Alt + Enter`: Run the current cell and insert a new cell below.\n", |
| 54 | + "\n", |
| 55 | + "4. **Code Assistance and Auto-completion:**\n", |
| 56 | + " - The Jupyter extension in VS Code offers code assistance and auto-completion. Press `Tab` for suggestions while writing code.\n", |
| 57 | + "\n", |
| 58 | + "5. **Saving and Renaming:**\n", |
| 59 | + " - Save your Jupyter notebook by clicking on `File` > `Save` or `File` > `Save As...`.\n", |
| 60 | + " - To rename the notebook, right-click on the notebook file in the file explorer on the left and select `Rename`.\n", |
| 61 | + "\n", |
| 62 | + "6. **Managing Cells:**\n", |
| 63 | + " - Use the `+ Code` or `+ Markdown` buttons in the Jupyter toolbar to add new code or text cells, respectively.\n", |
| 64 | + " - You can rearrange the order of cells by clicking and dragging them in the Jupyter notebook.\n", |
| 65 | + " - Right-click on a cell in the Jupyter notebook to access options like deleting or moving the cell." |
| 66 | + ] |
| 67 | + }, |
| 68 | + { |
| 69 | + "cell_type": "markdown", |
| 70 | + "metadata": {}, |
| 71 | + "source": [ |
| 72 | + "No problem! If you won't be using Google Colab or Drive, and you want to work exclusively in Visual Studio Code, here are modified instructions:\n", |
| 73 | + "\n", |
| 74 | + "## Instructions for Accessing and Using the `data` Folder in Visual Studio Code\n", |
| 75 | + "\n", |
| 76 | + "1. **Access GitHub Repository:**\n", |
| 77 | + " - Go to your GitHub repository where the `data` folder is located: [https://github.com/UofT-DSI/python](https://github.com/UofT-DSI/python)\n", |
| 78 | + " - Clone the repository to your local machine using the following command in your terminal or command prompt:\n", |
| 79 | + " ```\n", |
| 80 | + " git clone https://github.com/UofT-DSI/python.git\n", |
| 81 | + " ```\n", |
| 82 | + " - Navigate to the cloned repository on your local machine.\n", |
| 83 | + "\n", |
| 84 | + "2. **Access and Use the `data` Folder in Visual Studio Code:**\n", |
| 85 | + " - Open Visual Studio Code.\n", |
| 86 | + " - Open the folder corresponding to the cloned GitHub repository using the \"File\" > \"Open Folder...\" menu option.\n", |
| 87 | + " - You should now see the `data` folder in your Visual Studio Code workspace.\n", |
| 88 | + "\n", |
| 89 | + "3. **Working with the `data` Folder:**\n", |
| 90 | + " - You can access and use the contents of the `data` folder directly in your Python scripts or Jupyter notebooks within Visual Studio Code. For example, you can read data from files in the `data` folder using Python's file handling functions or libraries like Pandas." |
| 91 | + ] |
| 92 | + }, |
| 93 | + { |
| 94 | + "cell_type": "markdown", |
| 95 | + "metadata": {}, |
| 96 | + "source": [ |
| 97 | + "### What is Python?\n", |
| 98 | + "\n", |
| 99 | + "Python is a general-purpose programming language first released in 1991. It has since become a popular language for data science, thanks to an enthusiastic community and a large ecosystem of code libraries and tools that make it easier to perform common tasks throughout the data science life cycle." |
| 100 | + ] |
| 101 | + } |
| 102 | + ], |
| 103 | + "metadata": { |
| 104 | + "kernelspec": { |
| 105 | + "display_name": "dsi_participant", |
| 106 | + "language": "python", |
| 107 | + "name": "python3" |
| 108 | + }, |
| 109 | + "language_info": { |
| 110 | + "name": "python", |
| 111 | + "version": "3.11.8" |
| 112 | + } |
| 113 | + }, |
| 114 | + "nbformat": 4, |
| 115 | + "nbformat_minor": 2 |
| 116 | +} |
0 commit comments