Skip to content

Commit

Permalink
last minor revisions from pilot (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
jelletreep authored Sep 27, 2023
1 parent d774cfb commit fff9444
Show file tree
Hide file tree
Showing 16 changed files with 1,887 additions and 614 deletions.
2 changes: 1 addition & 1 deletion book/Introduction_to_python_1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
"version": "3.8.10"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions book/Introduction_to_python_2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"When we want to make use of a function (referred to as calling the function), we type the name of the function followed by parentheses. Between the parentheses we can pass arguments.\n",
"\n",
"**Arguments**\n",
"We typically provide a function with 'arguments' to tell python which values or variables are used to perform the body of the function. In the example below `type` is the function name and `pi_value` is the argument."
"Arguments are used by a function to perform the body of the function with the value of this argument. In the example below `type` is the function name and `pi_value` is the argument."
]
},
{
Expand Down Expand Up @@ -397,7 +397,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
"version": "3.8.10"
}
},
"nbformat": 4,
Expand Down
12 changes: 6 additions & 6 deletions book/Introduction_to_python_3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@
"source": [
"## Dictionaries\n",
"\n",
"A dictionary is another way to store multiple items into one object. In dictionaries, however, this is done with keys and values. This can be useful for several reasons, one example is to store model settings, parameters or variable values for multiple scenarios."
"A dictionary is another way to store multiple items into one object. In dictionaries, however, this is done with keys and values. In dictionaries, keys are typically use to look up values. A good analogy may be the contact list in your phone where you use a name (key) to lookup a phone number (value). This can be useful for several reasons, one example is to store model settings, parameters or variable values for multiple scenarios. "
]
},
{
Expand All @@ -532,7 +532,7 @@
"metadata": {},
"outputs": [],
"source": [
"my_dict = {'one': 'first', 'two': 'second'}\n",
"my_dict = {'one': 1, 'two': 2}\n",
"my_dict"
]
},
Expand Down Expand Up @@ -569,7 +569,7 @@
"metadata": {},
"outputs": [],
"source": [
"my_dict['third'] = 'three'\n",
"my_dict['three'] = 3\n",
"my_dict"
]
},
Expand All @@ -578,7 +578,7 @@
"id": "1043ec01",
"metadata": {},
"source": [
"Dictionary items are key-value pairs. The keys are changeable and unique. The values are changable, but not necessarily unique."
"Dictionary items are key-value pairs. The keys are changeable and always have to be unique (within a dictionary object). The values within a dictionary are changable, and don't have to be unique."
]
},
{
Expand All @@ -588,7 +588,7 @@
"metadata": {},
"outputs": [],
"source": [
"my_dict['two'] = 'three'\n",
"my_dict['two'] = 5\n",
"my_dict"
]
},
Expand Down Expand Up @@ -738,7 +738,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
"version": "3.8.10"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion book/Introduction_to_python_4.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
"version": "3.8.10"
}
},
"nbformat": 4,
Expand Down
4 changes: 4 additions & 0 deletions book/_quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ book:
- data-science-with-pandas-2.ipynb
- data-science-with-pandas-3.ipynb
- data-science-with-pandas-4.ipynb
- part: "Exercises solutions"
chapters:
- solutions/morning_exercises_solutions.ipynb
- solutions/afternoon_exercises_solutions.ipynb
- what-next.qmd
- references.qmd
repo-url: https://github.com/UtrechtUniversity/workshop-introduction-to-python
Expand Down
43 changes: 16 additions & 27 deletions book/data-science-with-pandas-1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"\n",
"A library (aka package) is a collection of files (aka python scripts) that contains **functions** that can be used to perform specific tasks. A library may also contain data. The functions in a library are typically related and used for a specific purpose, e.g. there are libraries for plotting, handling audio data and machine learning and many many more. Some libraries are built into python, but most packages need to be installed before you can use it.\n",
"\n",
"Important to add: libraries are developed and maintained by other Python users. A popular library like Pandas has a large user base and the maintainers are supported by several funders, which makes it a reliable library that is updated very frequently. But this is not always the case, on the other side of the spectrum, a library can also be published once and not maintained at all.\n",
"Libraries are developed and maintained by other Python users. That is why there are so many packages and this is great: there is a huge variety of functions available that you can use instead of programming them yourself. But it is important to be aware that the quality can differ. A popular library like Pandas has a large user base and the maintainers are supported by several funders, which makes it a reliable library that is updated very frequently. But this is not always the case, on the other side of the spectrum, a library can also be published once, badly designed/documented and/or not maintained at all. To check the quality of a library, you can check e.g. the number of downloads, the number of contributors, the number of open issues, the date of the last update and the number of stars on GitHub.\n",
"\n",
"## Pandas\n",
"The python library [**Pandas**](https://pandas.pydata.org/about/) is a popular open-source data analysis and data manipulation library for Python which was developed in 2008. The library has some similarities with R, mainly related to the DataFrame data type that is used to handle table like datasets.\n",
Expand Down Expand Up @@ -212,29 +212,6 @@
"It is, however, enough for a quick exploration of how the dataset looks like in terms of columns names, values, and potential reading errors."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-success\">\n",
"<b>Exercise 1</b>\n",
" \n",
"Now go to the Jupyter Dashboard in your internet browser and open the notebook `afternoon_exercises.ipynb` and do exercise 1.\n",
"</div>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"::: {.callout-note}\n",
"As you can see in this exercise a DataFrame object comes with several methods that can be applied to the DataFrame. A method is similar to a function, but it can only be applied to the object it belongs to and has a different notation than a function.\n",
"\n",
"Compare the notation of the function `len`: `len(surveys_df)` \n",
"with the DataFrame specific method `shape`: `surveys_df.shape`\n",
":::"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -356,12 +333,24 @@
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-success\">\n",
"<b>Exercise 2</b>\n",
"<b>Exercises 0 and 1</b>\n",
" \n",
"Now go to the Jupyter Dashboard in your internet browser and continue with exercise 2.\n",
"Now go to the Jupyter Dashboard in your internet browser and continue with exercises 0 and 1.\n",
"</div>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"::: {.callout-note}\n",
"As you can see in this exercise a DataFrame object comes with several methods that can be applied to the DataFrame. A method is similar to a function, but it can only be applied to the object it belongs to and has a different notation than a function.\n",
"\n",
"Compare the notation of the function `len`: `len(surveys_df)` \n",
"with the DataFrame specific method `shape`: `surveys_df.shape`\n",
":::"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -439,7 +428,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
"version": "3.8.10"
},
"vscode": {
"interpreter": {
Expand Down
14 changes: 7 additions & 7 deletions book/data-science-with-pandas-2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,9 @@
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-success\">\n",
"<b>Exercise 3 to 5</b>\n",
"<b>Exercise 2 to 4</b>\n",
" \n",
"Now go to the Jupyter Dashboard in your internet browser and continue with the afternoon exercises 3 to 5."
"Now go to the Jupyter Dashboard in your internet browser and continue with the afternoon exercises 2 to 4."
]
},
{
Expand Down Expand Up @@ -669,9 +669,9 @@
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-success\">\n",
"<b>Exercise 6 and 7</b>\n",
"<b>Exercise 5 and 6</b>\n",
"\n",
"Now go to the Jupyter Dashboard in your internet browser and continue with the afternoon exercises 6 and 7."
"Now go to the Jupyter Dashboard in your internet browser and continue with the afternoon exercises 5 and 6."
]
},
{
Expand Down Expand Up @@ -869,9 +869,9 @@
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-success\">\n",
"<b>Exercise 8 to 10</b>\n",
"<b>Exercise 7 to 9</b>\n",
" \n",
"Now go to the Jupyter Dashboard in your internet browser and continue with the afternoon exercises 8 to 10."
"Now go to the Jupyter Dashboard in your internet browser and continue with the afternoon exercises 7 to 9."
]
},
{
Expand Down Expand Up @@ -899,7 +899,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
"version": "3.8.10"
}
},
"nbformat": 4,
Expand Down
17 changes: 3 additions & 14 deletions book/data-science-with-pandas-3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -193,17 +193,6 @@
"vertical_stack.reset_index()"
]
},
{
"cell_type": "markdown",
"id": "f1db04a6-8ae2-44e4-9798-adc1b108c9d8",
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-success\">\n",
"<b>Exercise 11</b>\n",
" \n",
"Now go to the Jupyter Dashboard in your internet browser and continue with exercise 11.\n"
]
},
{
"cell_type": "markdown",
"id": "7bc415a6",
Expand Down Expand Up @@ -315,9 +304,9 @@
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-success\">\n",
"<b>Exercise 12</b>\n",
"<b>Exercise 10 and 11</b>\n",
" \n",
"Now go to the Jupyter Dashboard in your internet browser and continue with exercise 12.\n"
"Now go to the Jupyter Dashboard in your internet browser and continue with exercise 10 and 11.\n"
]
},
{
Expand Down Expand Up @@ -508,7 +497,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
"version": "3.8.10"
}
},
"nbformat": 4,
Expand Down
10 changes: 5 additions & 5 deletions book/data-science-with-pandas-4.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,9 @@
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-success\">\n",
"<b>Exercise 13</b>\n",
"<b>Exercise 12</b>\n",
" \n",
"Now go to the Jupyter Dashboard in your internet browser and continue with exercise 13.\n",
"Now go to the Jupyter Dashboard in your internet browser and continue with exercise 12.\n",
"</div>"
]
},
Expand Down Expand Up @@ -488,9 +488,9 @@
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-success\">\n",
"<b>Exercise 14</b>\n",
"<b>Exercise 13</b>\n",
" \n",
"Now go to the Jupyter Dashboard in your internet browser and continue with exercise 14.\n",
"Now go to the Jupyter Dashboard in your internet browser and continue with exercise 13.\n",
"</div>"
]
},
Expand Down Expand Up @@ -564,7 +564,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
"version": "3.8.10"
},
"toc": {
"base_numbering": 1,
Expand Down
19 changes: 10 additions & 9 deletions book/installation-and-setup.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ version 9 and below, are not).
3. Move the downloaded zip to the folder where you want to store these course materials.
4. Unzip the zip file.

In your `python-workshop` you will see two folders called `data` and `solutions` and the following files:
In your `python-workshop` you will see a folders called `data` and the following files:

```
python-workshop
Expand All @@ -82,11 +82,9 @@ python-workshop
│ ├── species.csv
│ ├── surveys.csv
│ └── plots.csv
├── solutions
│ ├── morning_exercises_solutions.ipynb
│ └── afternoon_exercises_solutions.ipynb
├── morning_exercises.ipynb
└── afternoon_exercises.ipynb
├── afternoon_exercises.ipynb
└── empty_notebook_for_code_along.ipynb
```

## Launch Python interface
Expand Down Expand Up @@ -139,9 +137,12 @@ Make your choice and click "Ok, and don't show again" button.
2. Find the "Notebook" tab and click on the "Launch" button.
Anaconda will open a new browser window or tab with a Notebook Dashboard showing you the
contents of your Home (or User) folder.
3. Navigate to the `python-workshop` directory by clicking on the directory names leading to it.
`Desktop` and then `python-workshop`:
4. Launch the notebook by clicking on the "New" button and then selecting "Python 3".
3. Navigate to the `data` directory by clicking on the directory names leading to it.
`Desktop`, `python-workshop`, then `data`:
4. Launch the notebook called `empty_notebook_for_code_along.ipynb` by clicking on it.
5. Run the first code cell just below "Test installation" by clicking on it and then click on the 'play button'.
If the output of the cell displays 4 version numbers and the words "No errors! Ready to code!" instead of an error message, your installation is successful. If not, contact us at [RDM walk in hours][walk-in-hours] or reply to the welcome email.

:::

### Option B: IPython interpreter
Expand Down Expand Up @@ -176,7 +177,7 @@ This workshop will make use of the following Python packages:
- `matplotlib`
- `numpy`

Anaconda Navigator comes with these packages, so you are ready to go. If you are using another option to work with Python, you need to install these packages. If you need help with this, please ask the internet, your colleagues or us (see welcome email).
Anaconda Navigator comes with these packages, so you are ready to go. If you are using another option to work with Python, you need to install these packages. We then assume that you know how to install packages, otherwise we recommend using Anaconda instead. If for some reason you cannot work with Anaconda and you need help with installing packages, we are happy to help during the [RDM walk in hours](https://www.uu.nl/en/research/research-data-management/workshops/walk-in-hours-research-data-and-software), or email us by replying to the welcome email.

## References {.unnumbered}

Expand Down
Loading

0 comments on commit fff9444

Please sign in to comment.