Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add observations.csv data #175

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions _solved/00-jupyter_introduction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"source": [
"<p><font size=\"6\"><b>Jupyter notebook INTRODUCTION </b></font></p>\n",
"\n",
"> *© 2021, Joris Van den Bossche and Stijn Van Hoey (<mailto:[email protected]>, <mailto:[email protected]>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)*\n",
"> *© 2022, Joris Van den Bossche and Stijn Van Hoey (<mailto:[email protected]>, <mailto:[email protected]>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)*\n",
"\n",
"---"
]
Expand Down Expand Up @@ -186,20 +186,6 @@
"#### subsubsection"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Raw Text"
]
},
{
"cell_type": "raw",
"metadata": {},
"source": [
"Cfr. any text editor"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -554,7 +540,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.9"
"version": "3.10.4"
},
"nav_menu": {},
"toc": {
Expand Down
10 changes: 5 additions & 5 deletions _solved/case1_bike_count.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"source": [
"<p><font size=\"6\"><b> CASE - Bike count data</b></font></p>\n",
"\n",
"> *© 2021, Joris Van den Bossche and Stijn Van Hoey (<mailto:[email protected]>, <mailto:[email protected]>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)*\n",
"> *© 2022, Joris Van den Bossche and Stijn Van Hoey (<mailto:[email protected]>, <mailto:[email protected]>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)*\n",
"\n",
"---"
]
Expand Down Expand Up @@ -187,8 +187,8 @@
"\n",
"Pre-process the data:\n",
"\n",
"* Combine the 'datum' and 'tijd' columns into one Pandas Series of string datetime values, call this new variable `combined`.\n",
"* Parse the string datetime values to `datetime` objects.\n",
"* Combine the 'datum' and 'tijd' columns into one Pandas Series of string values, call this new variable `combined`.\n",
"* Parse the string values to `datetime` objects.\n",
"* Set the resulting `datetime` column as the index of the `df` DataFrame.\n",
"* Remove the original 'datum' and 'tijd' columns using the `drop` method, and call the new dataframe `df2`.\n",
"* Rename the columns in the DataFrame 'ri Centrum', 'ri Mariakerke' to resp. 'direction_centre', 'direction_mariakerke' using the `rename` method.\n",
Expand Down Expand Up @@ -1148,7 +1148,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"So the daily pattern is clearly different for both directions. In the morning more people go north, in the evening more people go south. The morning peak is also more condensed."
"So the daily pattern is clearly different for both directions. In the morning more people go towards the centre, in the evening more people go back to Mariakerke. The morning peak is also more condensed."
]
},
{
Expand Down Expand Up @@ -1220,7 +1220,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.2"
"version": "3.10.4"
},
"nav_menu": {},
"toc": {
Expand Down
8 changes: 4 additions & 4 deletions _solved/case2_observations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"source": [
"<p><font size=\"6\"><b>CASE - Observation data</b></font></p>\n",
"\n",
"> *© 2021, Joris Van den Bossche and Stijn Van Hoey (<mailto:[email protected]>, <mailto:[email protected]>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)*\n",
"> *© 2022, Joris Van den Bossche and Stijn Van Hoey (<mailto:[email protected]>, <mailto:[email protected]>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)*\n",
"\n",
"---"
]
Expand Down Expand Up @@ -309,11 +309,11 @@
"\n",
"**EXERCISE**\n",
"\n",
"How many records in the data set have no information about the `species`? Use the `isna()` method to find out.\n",
"How many records in the data set have no information about the `species_ID`? Use the `isna()` method to find out.\n",
"\n",
"<details><summary>Hints</summary>\n",
"\n",
"- Do NOT use `survey_data_processed['species'] == np.nan`, but use the available method `isna()` to check if a value is NaN\n",
"- Do NOT use `survey_data_processed['species_ID'] == np.nan`, but use the available method `isna()` to check if a value is NaN\n",
"- The result of an (element-wise) condition returns a set of True/False values, corresponding to 1/0 values. The amount of True values is equal to the sum.\n",
" \n",
"</details>"
Expand Down Expand Up @@ -1673,7 +1673,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.2"
"version": "3.8.13"
},
"nav_menu": {},
"toc": {
Expand Down
4 changes: 2 additions & 2 deletions _solved/case2_observations_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"source": [
"<p><font size=\"6\"><b> CASE - Observation data - analysis</b></font></p>\n",
"\n",
"> *© 2021, Joris Van den Bossche and Stijn Van Hoey (<mailto:[email protected]>, <mailto:[email protected]>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)*\n",
"> *© 2022, Joris Van den Bossche and Stijn Van Hoey (<mailto:[email protected]>, <mailto:[email protected]>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)*\n",
"\n",
"---"
]
Expand Down Expand Up @@ -1319,7 +1319,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.2"
"version": "3.10.4"
},
"nav_menu": {},
"toc": {
Expand Down
4 changes: 2 additions & 2 deletions _solved/case2_observations_processing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"source": [
"<p><font size=\"6\"><b> CASE - Observation data - data cleaning and enrichment</b></font></p>\n",
"\n",
"> *© 2021, Joris Van den Bossche and Stijn Van Hoey (<mailto:[email protected]>, <mailto:[email protected]>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)*\n",
"> *© 2022, Joris Van den Bossche and Stijn Van Hoey (<mailto:[email protected]>, <mailto:[email protected]>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)*\n",
"\n",
"---"
]
Expand Down Expand Up @@ -2274,7 +2274,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.2"
"version": "3.10.4"
},
"nav_menu": {},
"toc": {
Expand Down
14 changes: 8 additions & 6 deletions _solved/case3_bacterial_resistance_lab_experiment.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"source": [
"<p><font size=\"6\"><b>CASE - Bacterial resistance experiment</b></font></p>\n",
"\n",
"> *© 2021, Joris Van den Bossche and Stijn Van Hoey (<mailto:[email protected]>, <mailto:[email protected]>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)*\n",
"> *© 2022, Joris Van den Bossche and Stijn Van Hoey (<mailto:[email protected]>, <mailto:[email protected]>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)*\n",
"\n",
"---"
]
Expand Down Expand Up @@ -525,14 +525,13 @@
"- Make sure the `WT(2)` and `MUT(2)` categories are used as respectively `WT` and `MUT` by adjusting them with Pandas first.\n",
"- Use the __falcor__ data and the Seaborn package. The 'log10 mutation rate' on the figure corresponds to the `log10 Mc` column.\n",
"\n",
"\n",
"<details><summary>Hints</summary>\n",
"\n",
"- To replace values using a mapping (dictionary with the keys the current values and the values the new values), use the Pandas `replace` method.\n",
"- This is another example of a `catplot`, using `point`s to represent the data.\n",
"- The `join` argument defines if individual points need to be connected or not.\n",
"- One combination appears multiple times, so make sure to not yet use confidence intervals by setting `ci` to `Null`.\n",
"\n",
"- Seaborn provides the `row_order` and `order` options to provide a custom order of respectively the subplots and categories.\n",
"- One combination appears multiple times, so make sure to not yet use confidence intervals by setting `errorbar` to `None`.\n",
"</details>"
]
},
Expand Down Expand Up @@ -568,7 +567,10 @@
" x='Bacterial_genotype',\n",
" y='log10 Mc',\n",
" row=\"Phage\",\n",
" join=False, ci=None,\n",
" join=False, \n",
" errorbar=None,\n",
" row_order=[\"Lambda\", \"T4\", \"T7\"],\n",
" order=['WT', 'MUT', 'D87G', 'S83L', 'D516G', 'S512F', 'K43N', 'K88R', 'RSF1010', 'RP4'],\n",
" aspect=3, height=3,\n",
" color=\"black\")"
]
Expand Down Expand Up @@ -679,7 +681,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.2"
"version": "3.10.4"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
Expand Down
4 changes: 2 additions & 2 deletions _solved/case4_air_quality_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"source": [
"<p><font size=\"6\"><b> CASE - air quality data of European monitoring stations (AirBase)</b></font></p>\n",
"\n",
"> *© 2021, Joris Van den Bossche and Stijn Van Hoey (<mailto:[email protected]>, <mailto:[email protected]>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)*\n",
"> *© 2022, Joris Van den Bossche and Stijn Van Hoey (<mailto:[email protected]>, <mailto:[email protected]>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)*\n",
"\n",
"---"
]
Expand Down Expand Up @@ -1329,7 +1329,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.2"
"version": "3.10.4"
},
"nav_menu": {},
"toc": {
Expand Down
4 changes: 2 additions & 2 deletions _solved/case4_air_quality_processing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"source": [
"<p><font size=\"6\"><b> CASE - air quality data of European monitoring stations (AirBase)</b></font></p>\n",
"\n",
"> *© 2021, Joris Van den Bossche and Stijn Van Hoey (<mailto:[email protected]>, <mailto:[email protected]>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)*\n",
"> *© 2022, Joris Van den Bossche and Stijn Van Hoey (<mailto:[email protected]>, <mailto:[email protected]>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)*\n",
"\n",
"---"
]
Expand Down Expand Up @@ -771,7 +771,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.2"
"version": "3.10.4"
},
"nav_menu": {},
"toc": {
Expand Down
6 changes: 3 additions & 3 deletions _solved/pandas_01_data_structures.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"source": [
"<p><font size=\"6\"><b>01 - Pandas: Data Structures </b></font></p>\n",
"\n",
"> *© 2021, Joris Van den Bossche and Stijn Van Hoey (<mailto:[email protected]>, <mailto:[email protected]>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)*\n",
"> *© 2022, Joris Van den Bossche and Stijn Van Hoey (<mailto:[email protected]>, <mailto:[email protected]>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)*\n",
"\n",
"---"
]
Expand Down Expand Up @@ -702,7 +702,7 @@
},
"outputs": [],
"source": [
"df['Fare'].plot(kind='box') # or .plot.box()"
"df['Fare'].plot.box() # or .plot(kind='box')"
]
},
{
Expand Down Expand Up @@ -765,7 +765,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.2"
"version": "3.10.8"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
Expand Down
6 changes: 3 additions & 3 deletions _solved/pandas_02_basic_operations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"<p><font size=\"6\"><b> 02 - Pandas: Basic operations on Series and DataFrames</b></font></p>\n",
"\n",
"\n",
"> *© 2021, Joris Van den Bossche and Stijn Van Hoey (<mailto:[email protected]>, <mailto:[email protected]>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)*\n",
"> *© 2022, Joris Van den Bossche and Stijn Van Hoey (<mailto:[email protected]>, <mailto:[email protected]>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)*\n",
"\n",
"---"
]
Expand Down Expand Up @@ -349,7 +349,7 @@
},
"outputs": [],
"source": [
"df['Age'].hist() #bins=30, log=True"
"df['Age'].plot.hist() # bins=30, log=True)"
]
},
{
Expand Down Expand Up @@ -780,7 +780,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.2"
"version": "3.10.8"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
Expand Down
20 changes: 17 additions & 3 deletions _solved/pandas_03a_selecting_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"<p><font size=\"6\"><b>03 - Pandas: Indexing and selecting data - part I</b></font></p>\n",
"\n",
"\n",
"> *© 2021, Joris Van den Bossche and Stijn Van Hoey (<mailto:[email protected]>, <mailto:[email protected]>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)*\n",
"> *© 2022, Joris Van den Bossche and Stijn Van Hoey (<mailto:[email protected]>, <mailto:[email protected]>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)*\n",
"\n",
"---"
]
Expand Down Expand Up @@ -656,7 +656,7 @@
"id": "49d05bde",
"metadata": {},
"source": [
"For the quick ones among you, here are some more exercises with some larger dataframe with film data. These exercises are based on the [PyCon tutorial of Brandon Rhodes](https://github.com/brandon-rhodes/pycon-pandas-tutorial/) (so all credit to him!) and the datasets he prepared for that. You can download these data from here: [`titles.csv`](https://course-python-data.s3.eu-central-1.amazonaws.com/titles.csv) and [`cast.csv`](https://course-python-data.s3.eu-central-1.amazonaws.com/cast.csv) and put them in the `/notebooks/data` folder."
"For the quick ones among you, here are some more exercises with some larger dataframe with film data. These exercises are based on the [PyCon tutorial of Brandon Rhodes](https://github.com/brandon-rhodes/pycon-pandas-tutorial/) (so all credit to him!) and the datasets he prepared for that. You can download these data from here: [titles.csv](https://course-python-data.s3.eu-central-1.amazonaws.com/titles.csv) and [cast.csv](https://course-python-data.s3.eu-central-1.amazonaws.com/cast.csv) and put them in the `/notebooks/data` folder."
]
},
{
Expand Down Expand Up @@ -740,6 +740,20 @@
"titles.sort_values('year').head(2)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "95a214f4-2ce3-4f56-9dfa-e546acdf12a5",
"metadata": {
"tags": [
"nbtutor-solution"
]
},
"outputs": [],
"source": [
"titles.nsmallest(2, columns=\"year\")"
]
},
{
"cell_type": "markdown",
"id": "1150e93f",
Expand Down Expand Up @@ -1023,7 +1037,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.2"
"version": "3.10.8"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
Expand Down
6 changes: 3 additions & 3 deletions _solved/pandas_03b_indexing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"source": [
"<p><font size=\"6\"><b>03 - Pandas: Indexing and selecting data - part II</b></font></p>\n",
"\n",
"> *© 2021, Joris Van den Bossche and Stijn Van Hoey (<mailto:[email protected]>, <mailto:[email protected]>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)*\n",
"> *© 2022, Joris Van den Bossche and Stijn Van Hoey (<mailto:[email protected]>, <mailto:[email protected]>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)*\n",
"\n",
"---"
]
Expand Down Expand Up @@ -696,7 +696,7 @@
"formats": "ipynb,md:myst"
},
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -710,7 +710,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.10.8"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
Expand Down
Loading