Skip to content

Commit 6a0ea34

Browse files
committed
♻️ Renumber exercises and clean up
1 parent d9c4a15 commit 6a0ea34

16 files changed

+515
-1361
lines changed

02_pandas.ipynb

+5-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@
2424
"cell_type": "markdown",
2525
"metadata": {},
2626
"source": [
27-
"Um ein Paket zu benutzen, musst du es zuerst importieren:"
27+
"Um ein Paket zu benutzen, musst du es zuerst importieren:\n",
28+
"\n",
29+
"Um den Code auszuführen, klicke in die Zeile und drücke SHIFT (Hochstelltaste) und ENTER.\n",
30+
"\n",
31+
"Wenn eine Code-Zeile noch nicht ausgeführt wurde, dann ist die [ ] Klammer davor leer, wenn sie ausgeführt wurde, steht in der Klammer eine Nummer: [1]."
2832
]
2933
},
3034
{

06b_excel.ipynb 07_excel.ipynb

File renamed without changes.

08_ggplot.ipynb

-245
This file was deleted.

05_json.ipynb 08_json.ipynb

+27-8
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
"source": [
1414
"Neben CSV-Dateien gibt es noch viele andere Strukturen, in denen Daten vorliegen und kommuniziert werden können. Ein verbreitetes Format nennt sich JSON. JSON steht für **JavaScript Object Notation**, ist jedoch von vielen Programmiersprachen und Tools adoptiert worden; So auch von Python.\n",
1515
"\n",
16-
"Während im Fall von CSV jeder Dateneintrag die selbe Form hat (jede Zeile hat genau einen Wert für jede Spalte), erlaubt JSON eine sehr freie Form. Dies wird erreicht, indem jeder **Wert** einen bestimmten Namen zugeordnet hat, ein sogenannter **Schlüssel**. Im Jargon bezeichnet man so eine Kombination von Schlüssel und Wert ein **key/value pair**.\n",
16+
"Während im Fall von CSV jeder Dateneintrag die selbe Form hat (jede Zeile hat genau einen Wert für jede Spalte), erlaubt JSON eine sehr freie Form. Dies wird erreicht, indem jeder **Wert** einen bestimmten Namen zugeordnet hat, ein sogenannter **Schlüssel**. Programmierer:innen nennen so eine Kombination von Schlüssel und Wert **key/value pair**.\n",
1717
"\n",
18-
"Schauen wir uns ein einfaches Beispiel an:"
18+
"Schauen wir uns ein Beispiel an:"
1919
]
2020
},
2121
{
@@ -39,7 +39,7 @@
3939
"source": [
4040
"Unser einfaches Beispiel beschreibt eine Person und demonstriert die Datentypen, die ein JSON-Datensatz enthalten kann. Er ähnelt in der Erscheinung und Funktion einem `dict` in Python.\n",
4141
"\n",
42-
"Betrachten wir das Beispiel Zeile für Zeile:\n",
42+
"Zeile für Zeile:\n",
4343
"\n",
4444
"- `{`\n",
4545
" - Geschweifte Klammern signalisieren den Anfang und Ende eines **Objektes**. Objekte sind Sammlungen von key/value-Paaren. In Python werden diese als `dict` repräsentiert.\n",
@@ -76,7 +76,7 @@
7676
" \"height\": 1.86,\n",
7777
" \"working_remote\": true,\n",
7878
" \"car\": {\n",
79-
" \"maker\": \"Toyota\",\n",
79+
" \"make\": \"Toyota\",\n",
8080
" \"model\": \"Auris\"\n",
8181
" },\n",
8282
" \"hobbies\": [\n",
@@ -110,11 +110,22 @@
110110
},
111111
{
112112
"cell_type": "code",
113-
"execution_count": null,
113+
"execution_count": 1,
114114
"metadata": {
115115
"tags": []
116116
},
117-
"outputs": [],
117+
"outputs": [
118+
{
119+
"name": "stdout",
120+
"output_type": "stream",
121+
"text": [
122+
"42\n",
123+
"True\n",
124+
"[1, 2, 3, '4', 5.0, {'6': None}]\n",
125+
"{'key': 'value'}\n"
126+
]
127+
}
128+
],
118129
"source": [
119130
"import json\n",
120131
"\n",
@@ -133,11 +144,19 @@
133144
},
134145
{
135146
"cell_type": "code",
136-
"execution_count": null,
147+
"execution_count": 2,
137148
"metadata": {
138149
"tags": []
139150
},
140-
"outputs": [],
151+
"outputs": [
152+
{
153+
"name": "stdout",
154+
"output_type": "stream",
155+
"text": [
156+
"Hobbies von Jannes: Programmieren, Musik machen, Zocken\n"
157+
]
158+
}
159+
],
141160
"source": [
142161
"import json\n",
143162
"\n",

07_api.ipynb 09_api.ipynb

File renamed without changes.
File renamed without changes.

11_ggplot.ipynb

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# ggplot for Python"
8+
]
9+
},
10+
{
11+
"cell_type": "markdown",
12+
"metadata": {},
13+
"source": [
14+
"Dieses Notebook zeigt kurz die Funktionsweise eines Visualisierungspakets, das ursprünglich für die statistische Programmiersprache R entwickelt wurde. Mit ggplot lassen sich \"schönere\" Visualisierungen erzeugen - deshalb wurde das Paket auch für Python \"übersetzt\".\n",
15+
"\n",
16+
"Informationen zu `ggplot` hier: https://www.dummies.com/article/technology/programming-web-design/r/ggplot2-works-r-251577/\n",
17+
"\n",
18+
"Dokumentation der Python-Übersetzung `plotnine` hier: https://plotnine.readthedocs.io/en/stable/ "
19+
]
20+
},
21+
{
22+
"cell_type": "code",
23+
"execution_count": null,
24+
"metadata": {},
25+
"outputs": [],
26+
"source": [
27+
"import pandas as pd\n",
28+
"import numpy as np\n",
29+
"from pandas.api.types import CategoricalDtype\n",
30+
"from plotnine import *\n",
31+
"from plotnine.data import mpg\n",
32+
"%matplotlib inline"
33+
]
34+
},
35+
{
36+
"cell_type": "code",
37+
"execution_count": null,
38+
"metadata": {},
39+
"outputs": [],
40+
"source": [
41+
"mpg.head()"
42+
]
43+
},
44+
{
45+
"cell_type": "code",
46+
"execution_count": null,
47+
"metadata": {},
48+
"outputs": [],
49+
"source": [
50+
"(ggplot(mpg) # defining what data to use\n",
51+
" + aes(x='class') # defining what variable to use\n",
52+
" + geom_bar(size=20) # defining the type of plot to use\n",
53+
")"
54+
]
55+
},
56+
{
57+
"cell_type": "code",
58+
"execution_count": null,
59+
"metadata": {},
60+
"outputs": [],
61+
"source": [
62+
"(ggplot(mpg)\n",
63+
" + aes(x='displ', y='hwy', color='class')\n",
64+
" + geom_point()\n",
65+
" + labs(title='Engine Displacement vs. Highway Miles per Gallon', x='Engine Displacement, in Litres', y='Highway Miles per Gallon')\n",
66+
")"
67+
]
68+
},
69+
{
70+
"cell_type": "code",
71+
"execution_count": null,
72+
"metadata": {},
73+
"outputs": [],
74+
"source": []
75+
}
76+
],
77+
"metadata": {
78+
"kernelspec": {
79+
"display_name": "Python 3",
80+
"language": "python",
81+
"name": "python3"
82+
},
83+
"language_info": {
84+
"codemirror_mode": {
85+
"name": "ipython",
86+
"version": 3
87+
},
88+
"file_extension": ".py",
89+
"mimetype": "text/x-python",
90+
"name": "python",
91+
"nbconvert_exporter": "python",
92+
"pygments_lexer": "ipython3",
93+
"version": "3.6.9"
94+
}
95+
},
96+
"nbformat": 4,
97+
"nbformat_minor": 4
98+
}
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)