diff --git a/book/_quarto.yml b/book/_quarto.yml index 0a3b4cf..a4da13e 100644 --- a/book/_quarto.yml +++ b/book/_quarto.yml @@ -1,6 +1,7 @@ project: type: book - output-dir: ../docs + + output-dir: ./docs book: title: "Introduction to Python & Data" @@ -34,8 +35,10 @@ book: - solutions/afternoon_exercises_solutions.ipynb - what-next.qmd - references.qmd - repo-url: https://github.com/UtrechtUniversity/workshop-introduction-to-python - repo-actions: [edit] + repo-url: https://github.com/UtrechtUniversity/workshop-introduction-to-python/ + repo-subdir: book + issue-url: https://github.com/UtrechtUniversity/workshop-introduction-to-python/issues/new + repo-actions: [edit, issue, source] sidebar: logo: images/python-hex-logo.png diff --git a/book/schedule.qmd b/book/schedule.qmd index 3bdf442..4b791ba 100644 --- a/book/schedule.qmd +++ b/book/schedule.qmd @@ -5,9 +5,9 @@ | 9:00 | Walk-in, tech support | | 9:30 | Introductions | | 10:00 | Python Fundamentals Chapters 1-3: _Exercises 0-3_ | -| 11:25 | Recap & Questions | -| **11:30** | **Coffee break** | -| 11:45 | Python Fundamentals Chapters 4-5: _Exercises 4-9_ | +| 10:55 | Recap & Questions | +| **11:00** | **Coffee break** | +| 11:15 | Python Fundamentals Chapters 4-5: _Exercises 4-9_ | | 12:40 | Recap & Questions | | **12:45** | **Lunch break** | | 13:30 | Data Science with Pandas Chapters 6-7: _Exercises 0-4_ | diff --git a/course_materials/empty_notebook_for_coding_along.ipynb b/course_materials/empty_notebook_for_coding_along.ipynb deleted file mode 100644 index 08712f7..0000000 --- a/course_materials/empty_notebook_for_coding_along.ipynb +++ /dev/null @@ -1,92 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "6be8c60c-486a-49ec-860d-e8dc361928ad", - "metadata": {}, - "source": [ - "# Code along\n", - "\n", - "Use this notebook to code along during the live coding lectures.\n", - "Use the dedicated exercises notebooks `morning_exercises.ipynb` and `afternoon_exercises.ipynb` for the exercises parts." - ] - }, - { - "cell_type": "markdown", - "id": "c239edb5", - "metadata": {}, - "source": [ - "## Test Installation" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "d8e35e29-a355-45e7-a693-624f0ee80b2b", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "3.8.10\n", - "1.5.3\n", - "3.6.3\n", - "1.24.1\n", - "No errors! Ready to code!\n" - ] - } - ], - "source": [ - "from platform import python_version\n", - "\n", - "import pandas as pd\n", - "import matplotlib\n", - "import numpy as np\n", - "\n", - "print(python_version())\n", - "print(pd.__version__)\n", - "print(matplotlib.__version__)\n", - "print(np.__version__)\n", - "print(\"No errors! Ready to code!\")" - ] - }, - { - "cell_type": "markdown", - "id": "2d5cbbaf", - "metadata": {}, - "source": [ - "## Code along" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "14183541", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "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.8.10" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/course_materials/preparation.ipynb b/course_materials/preparation.ipynb new file mode 100644 index 0000000..f047f27 --- /dev/null +++ b/course_materials/preparation.ipynb @@ -0,0 +1,197 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "6be8c60c-486a-49ec-860d-e8dc361928ad", + "metadata": {}, + "source": [ + "# Preparation\n", + "\n", + "Use this notebook to prepare for the workshop and for coding along during the lectures.\n", + "Use the dedicated exercises notebooks `morning_exercises.ipynb` and `afternoon_exercises.ipynb` for the exercises parts." + ] + }, + { + "cell_type": "markdown", + "id": "c239edb5", + "metadata": {}, + "source": [ + "## Preparation step 1: Introduction to Jupyter notebooks" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "A Jupyter Notebook is:\n", + "\n", + "> an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and narrative text. ([jupyter.org](https://jupyter.org/))\n", + "\n", + "A Notebook consists of one or more \"cells\" in which you can put text and code. The text you are reading right now is placed in a `Markdown` cell. Click somewhere on this text _once_ and verify this at the top of this page.\n", + "\n", + "The next cell is a `Code` cell. The current notebook uses a Python interpreter (check the top right corner to verify, it will display `Python 3 (ipykernel)`) which means it expects Python code and can only interpret Python code. Different setups are also possible (e.g. with an `R` or `Julia` interpreter). \n", + "\n", + "Click `Python 3 (ipykernel)`, and change the kernel to `geo-kernel`. This is a different Python interpreter where we preinstalled all Python packages that we need for this workshop.\n", + "\n", + "Select the following cell, verify at the top of this window if it displays `Code` instead of `Markdown`, and either click the 'play'-button above or press `-` simultaneously to run the Python code." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "print('Hello world!')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Check that the output is printed below the cell!\n", + "\n", + "Markdown cells can contain a wide variety of things:\n", + "\n", + "- Headers\n", + "- Lists\n", + "- Lengthy paragraphs\n", + "- Tables\n", + "- Images\n", + "- Equations\n", + "\n", + "See the examples below, and double click this cell to see how to create these things.\n", + "\n", + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Facilisis sed odio morbi quis commodo odio aenean sed adipiscing. Cras fermentum odio eu feugiat pretium. At urna condimentum mattis pellentesque id nibh tortor. Blandit libero volutpat sed cras ornare arcu dui vivamus arcu. Iaculis eu non diam phasellus vestibulum lorem sed risus. Purus sit amet luctus venenatis. Egestas fringilla phasellus faucibus scelerisque eleifend donec. Quam id leo in vitae. Eget aliquet nibh praesent tristique magna. Bibendum neque egestas congue quisque egestas diam in. Diam sit amet nisl suscipit. Tellus pellentesque eu tincidunt tortor aliquam nulla. Nisl nisi scelerisque eu ultrices vitae auctor eu augue ut. Metus vulputate eu scelerisque felis imperdiet. Tristique risus nec feugiat in fermentum posuere urna nec. Egestas congue quisque egestas diam in arcu cursus. Mi sit amet mauris commodo quis imperdiet.\n", + "\n", + "| column 1 | Column 2|\n", + "|---|---|\n", + "| 0 | 1 | \n", + "| 4 | 5.5| \n", + "| 5 | 3 | \n", + "\n", + "**The Cauchy-Schwarz Inequality**\n", + "$$\\left( \\sum_{k=1}^n a_k b_k \\right)^2 \\leq \\left( \\sum_{k=1}^n a_k^2 \\right) \\left( \\sum_{k=1}^n b_k^2 \\right)$$\n", + "\n", + "\n", + "\n", + "Follow this [link](https://www.markdownguide.org/basic-syntax/) for more markdown formatting examples" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Click this cell, and hit `B` on your keyboard to create a new cell below. You can also click the `+` sign at the top of this screen. You can ignore the new cell and continue reading..." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Code cells can contain all of your Python code. You can put many lines of code into one cell, or create many cells with only a few lines of code. You can define variables and functions in one cell and call them in another cell. However, you need to be aware that the order in which you run the cells matters. Try to run the cells below to understand what we mean:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "print(a)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "a = 6" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "print(a)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "A finished notebook should contain python code cells that can be run from the top to the bottom of the notebook. When your notebook becomes more complex, typically what happens is that because you have been running and changing and rerunning code cells while developing, the logic of your python code from top to bottom breaks. To prevent this (or at least get notified in an early stage) it is good practice to regularly restart the Python 'kernel' and run all the cells from top to bottom (or up to the selected cell). Click the Kernel tab at the top of this window and verify if you see these options, and click `Restart Kernel and Run up to Selected Cell`." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Here we end the brief introduction to Jupyter notebooks. If you are interested, check out the documentation at the [jupyter website](https://docs.jupyter.org/en/latest/)" + ] + }, + { + "cell_type": "markdown", + "id": "2d5cbbaf", + "metadata": {}, + "source": [ + "## Preparation step 2: Test installation\n", + "\n", + "Run the cell below to check if your all installations are is complete, if you see some numbers and the message: `No errors! Ready to code!`, all the relevant libraries are correctly installed and you are ready for the workshop!\n", + "If this is not the case, contact us (see the welcome email for instructions)." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d8e35e29-a355-45e7-a693-624f0ee80b2b", + "metadata": {}, + "outputs": [], + "source": [ + "from platform import python_version\n", + "\n", + "import pandas as pd\n", + "import matplotlib\n", + "import numpy as np\n", + "\n", + "print(python_version())\n", + "print(pd.__version__)\n", + "print(matplotlib.__version__)\n", + "print(np.__version__)\n", + "print(\"No errors! Ready to code!\")" + ] + }, + { + "cell_type": "markdown", + "id": "b9d2ce0a-75fb-48c4-8524-b4cb8e4ffeff", + "metadata": {}, + "source": [ + "# Chapter 2" + ] + } + ], + "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.10.8" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}