Skip to content

Commit e5203dc

Browse files
authored
Add files via upload
1 parent 8493664 commit e5203dc

File tree

1 file changed

+366
-0
lines changed

1 file changed

+366
-0
lines changed

week_1/tutorial_week1.ipynb

+366
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,366 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"__IMPORTANT INFO__\n",
8+
"<br>\n",
9+
"Note that you can find all the workshop materials under the following link, each session being marked as \"week_x\":\n",
10+
"<br>\n",
11+
"<br>\n",
12+
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[https://github.com/CodeHubOrg/python_workshops](https://github.com/CodeHubOrg/python_workshops)\n",
13+
"<br>\n",
14+
"<br>\n",
15+
"Download the data files by clicking on the 'Clone or download' green button, choose 'Download ZIP', then unzip from your downloads folder. We will update the material before each session."
16+
]
17+
},
18+
{
19+
"cell_type": "markdown",
20+
"metadata": {},
21+
"source": [
22+
"# An Introduction to Python\n",
23+
"This workshop is divided into 5 parts:\n",
24+
"* An overview of the workshops\n",
25+
"* An introduction to how to install Python and a few Python tools on your machine using Anaconda\n",
26+
"* An short guide to using Jupyter notebooks\n",
27+
"* A short guide to using the PyCharm (for Anaconda) editor\n",
28+
"* A quick overview of the more important Python packages for data science projects"
29+
]
30+
},
31+
{
32+
"cell_type": "markdown",
33+
"metadata": {},
34+
"source": [
35+
"# Part 1. Python Workshops"
36+
]
37+
},
38+
{
39+
"cell_type": "markdown",
40+
"metadata": {},
41+
"source": [
42+
"| | | | |\n",
43+
"|:------|:-------|:--------------------------------------------|:----------------------------------------------------|\n",
44+
"| 1 |15.01.20|Setting up the Python environment |Overview of workshops |\n",
45+
"| | | |Python installation |\n",
46+
"| | | |Anaconda | \n",
47+
"| | | |Jupyter notebooks | \n",
48+
"| | | |PyCharm IDE for debugging | \n",
49+
"| | | |Jupyter notebooks |\n",
50+
"| | | |Packages and environments | "
51+
]
52+
},
53+
{
54+
"cell_type": "markdown",
55+
"metadata": {},
56+
"source": [
57+
"| | | | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |\n",
58+
"|:------|:-------|:--------------------------------------------|:----------------------------------------------------|\n",
59+
"| 2 |29.01.20|Data structures |Data types (string, integer, float) |\n",
60+
"| | | |Lists | \n",
61+
"| | | |Dictionaries |\n",
62+
"| | | |Arrays |"
63+
]
64+
},
65+
{
66+
"cell_type": "markdown",
67+
"metadata": {},
68+
"source": [
69+
"| | | | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |\n",
70+
"|:------|:-------|:--------------------------------------------|:----------------------------------------------------|\n",
71+
"| 3 |12.02.20|Programming fundamentals I |Conditionals | \n",
72+
"| | | |For/while loops | \n",
73+
"| | | |Try/except statements | "
74+
]
75+
},
76+
{
77+
"cell_type": "markdown",
78+
"metadata": {},
79+
"source": [
80+
"| | | | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |\n",
81+
"|:------|:-------|:--------------------------------------------|:----------------------------------------------------|\n",
82+
"| 4 |26.02.20|Programming fundamentals II |Functions | \n",
83+
"| | | |Debugging in PyCharm |"
84+
]
85+
},
86+
{
87+
"cell_type": "markdown",
88+
"metadata": {},
89+
"source": [
90+
"| | | | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |\n",
91+
"|:------|:-------|:--------------------------------------------|:----------------------------------------------------|\n",
92+
"| 5 |11.03.20|Working with data |Introduction to Pandas | \n",
93+
"| | | |Loading/saving/manipulating data with Pandas | "
94+
]
95+
},
96+
{
97+
"cell_type": "markdown",
98+
"metadata": {},
99+
"source": [
100+
"| | | | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |\n",
101+
"|:------|:-------|:--------------------------------------------|:----------------------------------------------------|\n",
102+
"| 6 |25.03.20|Vizualizations |Introduction to Matplotlib |"
103+
]
104+
},
105+
{
106+
"cell_type": "markdown",
107+
"metadata": {},
108+
"source": [
109+
"| | | | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |\n",
110+
"|:------|:-------|:--------------------------------------------|:----------------------------------------------------|\n",
111+
"| 7 |08.04.20|Testing |Test your Python code |"
112+
]
113+
},
114+
{
115+
"cell_type": "markdown",
116+
"metadata": {},
117+
"source": [
118+
"# Part 2. Python/Python Tools Installation Guide \n",
119+
"We will be using Python 3.7 during this tutorial. To install Python, please use the instructions below.\n",
120+
"### Install Anaconda \n",
121+
"* go to the official Anaconda website **[https://www.anaconda.com/distribution/](https://www.anaconda.com/distribution/)** and download the installation corresponding to your machine, e.g, for MacOS:\n",
122+
"<img src=\"images/Screenshot1.png\" alt=\"Anaconda installation MacOS\" style=\"width: 600px;\"/>\n",
123+
"* Follow the installation instructions until the end. It might take a while if it's the first time you install it."
124+
]
125+
},
126+
{
127+
"cell_type": "raw",
128+
"metadata": {},
129+
"source": [
130+
"### Anaconda Tools\n",
131+
"* Launch the Anaconda app\n",
132+
"<br>\n",
133+
"<img src=\"images/Anaconda_navigator.png\" alt=\"Launch the Anaconda navigator\" style=\"width: 600px;\"/>\n",
134+
"<br>\n",
135+
"* Browse through the available tools\n",
136+
"<br>\n",
137+
"<img src=\"images/Anaconda_tools.png\" alt=\"Anaconda tools\" style=\"width: 600px;\"/>\n",
138+
"<br>\n",
139+
"* Open a Jupyter notebook\n",
140+
"<br>\n",
141+
"<img src=\"images/Jupyter_cmd.png\" alt=\"Automatic launch of the command line\" style=\"width: 600px;\"/>\n",
142+
"<br>\n",
143+
"<img src=\"images/Jupyter_web.png\" alt=\"Jupyter notebook interface\" style=\"width: 600px;\"/>\n",
144+
"<br>\n",
145+
"<img src=\"images/Jupyter_web_WTH.png\" alt=\"Jupyter notebook\" style=\"width: 600px;\"/>"
146+
]
147+
},
148+
{
149+
"cell_type": "markdown",
150+
"metadata": {},
151+
"source": [
152+
"### Install PyCharm IDE\n",
153+
"* Install PyCharm IDE for Anaconda from **[https://www.jetbrains.com/pycharm/promo/anaconda/](https://www.jetbrains.com/pycharm/promo/anaconda/)** since we will be using this for part 4 of the tutorial. Make sure you install the free Community Edition version!\n",
154+
"<br>\n",
155+
"* IMPORTANT: Use the recommended installation defaults if it's the first time using PyCharm.\n",
156+
"<br>\n",
157+
"<img src=\"images/Screenshot6.png\" alt=\"PyCharm installation step 1\" style=\"width: 600px;\"/>"
158+
]
159+
},
160+
{
161+
"cell_type": "markdown",
162+
"metadata": {},
163+
"source": [
164+
"# Part 3. Jupyter notebooks "
165+
]
166+
},
167+
{
168+
"cell_type": "markdown",
169+
"metadata": {},
170+
"source": [
171+
"## Jupyter modes"
172+
]
173+
},
174+
{
175+
"cell_type": "markdown",
176+
"metadata": {},
177+
"source": [
178+
"### Command mode\n",
179+
"The cell is highlighted blue.\n",
180+
"<br>\n",
181+
"<img src=\"images/Jupyter_command_mode.png\" alt=\"Jupyter command mode\" style=\"width: 600px;\"/>\n",
182+
"### Edit mode\n",
183+
"The cell is highlighted green.\n",
184+
"<br>\n",
185+
"<img src=\"images/Jupyter_edit_mode.png\" alt=\"Jupyter edit mode\" style=\"width: 600px;\"/>"
186+
]
187+
},
188+
{
189+
"cell_type": "markdown",
190+
"metadata": {},
191+
"source": [
192+
"## Jupyter cell types"
193+
]
194+
},
195+
{
196+
"cell_type": "markdown",
197+
"metadata": {},
198+
"source": [
199+
"### Code\n",
200+
"<br>\n",
201+
"<img src=\"images/Jupyter_code.png\" alt=\"Jupyter code\" style=\"width: 600px;\"/>"
202+
]
203+
},
204+
{
205+
"cell_type": "markdown",
206+
"metadata": {},
207+
"source": [
208+
"### Markdown\n",
209+
"<br>\n",
210+
"<img src=\"images/Jupyter_markdown.png\" alt=\"Jupyter markdown\" style=\"width: 600px;\"/>"
211+
]
212+
},
213+
{
214+
"cell_type": "markdown",
215+
"metadata": {},
216+
"source": [
217+
"### Raw NBConvert\n",
218+
"<br>\n",
219+
"<img src=\"images/Jupyter_raw_nbconvert.png\" alt=\"Jupyter raw NBConvert\" style=\"width: 600px;\"/>"
220+
]
221+
},
222+
{
223+
"cell_type": "markdown",
224+
"metadata": {},
225+
"source": [
226+
"## Jupyter keyboard shortcuts\n",
227+
"<br>\n",
228+
"<img src=\"images/Jupyter_keyboard_1.png\" alt=\"Jupyter keyboard 1\" style=\"width: 600px;\"/>\n",
229+
"<br>\n",
230+
"<img src=\"images/Jupyter_keyboard_2.png\" alt=\"Jupyter keyboard 2\" style=\"width: 600px;\"/>\n",
231+
"<br>\n",
232+
"<img src=\"images/Jupyter_keyboard_3.png\" alt=\"Jupyter keyboard 3\" style=\"width: 600px;\"/>\n",
233+
"<br>\n",
234+
"<img src=\"images/Jupyter_keyboard_4.png\" alt=\"Jupyter keyboard 4\" style=\"width: 600px;\"/>"
235+
]
236+
},
237+
{
238+
"cell_type": "markdown",
239+
"metadata": {},
240+
"source": [
241+
"# Part 4. PyCharm for Anaconda\n",
242+
"### Setting up the Python environment\n",
243+
"* For your first Python project, use the Conda environment.\n",
244+
"<br>\n",
245+
"<img src=\"images/PyCharm_launch.png\" alt=\"PyCharm launch\" style=\"width: 600px;\"/>\n",
246+
"<br>\n",
247+
"<img src=\"images/PyCharm_create_project.png\" alt=\"PyCharm create project\" style=\"width: 600px;\"/>\n",
248+
"<br>\n",
249+
"<img src=\"images/Screenshot7.png\" alt=\"PyCharm set environment\" style=\"width: 600px;\"/>\n",
250+
"<br>\n",
251+
"* Congrats! You have created your first Python project in PyCharm! \n",
252+
"<br>\n",
253+
"* You can now try to run/debug a short example in PyCharm."
254+
]
255+
},
256+
{
257+
"cell_type": "markdown",
258+
"metadata": {},
259+
"source": [
260+
"### Run a script in Pycharm\n",
261+
"* First, add a file to your project. The file should print a line of text of your choice to the screen.\n",
262+
"<br>\n",
263+
"<img src=\"images/PyCharm_add_python_file1.png\" alt=\"PyCharm add file\" style=\"width: 600px;\"/>\n",
264+
"<br>\n",
265+
"<img src=\"images/PyCharm_add_python_file2.png\" alt=\"PyCharm add file\" style=\"width: 600px;\"/>\n",
266+
"<br>\n",
267+
"* Run the script and check what happens.\n",
268+
"<br>\n",
269+
"<img src=\"images/PyCharm_run_python_file1.png\" alt=\"PyCharm run file 1\" style=\"width: 600px;\"/>\n",
270+
"<br>\n",
271+
"<img src=\"images/PyCharm_run_python_file2.png\" alt=\"PyCharm run file 2\" style=\"width: 600px;\"/>"
272+
]
273+
},
274+
{
275+
"cell_type": "markdown",
276+
"metadata": {},
277+
"source": [
278+
"### Debug a script in Pycharm\n",
279+
"* Let's add a new print line and a breakpoint in front of this line. \n",
280+
"<br>\n",
281+
"<img src=\"images/PyCharm_debug_python_file1.png\" alt=\"PyCharm debug file 1\" style=\"width: 600px;\"/>\n",
282+
"<br>\n",
283+
"* Debug the file and check the variables.\n",
284+
"<br>\n",
285+
"<img src=\"images/PyCharm_debug_python_file2.png\" alt=\"PyCharm debug file 2\" style=\"width: 600px;\"/>\n",
286+
"<br>\n",
287+
"<img src=\"images/PyCharm_debug_python_file3.png\" alt=\"PyCharm debug file 3\" style=\"width: 600px;\"/>\n",
288+
"<br>\n",
289+
"<img src=\"images/PyCharm_debug_python_file4.png\" alt=\"PyCharm debug file 4\" style=\"width: 600px;\"/>"
290+
]
291+
},
292+
{
293+
"cell_type": "markdown",
294+
"metadata": {},
295+
"source": [
296+
"# Part 5. Python Packages\n",
297+
"There are a few Python packages which are useful te get familiarized with if you plan to work on data science projects"
298+
]
299+
},
300+
{
301+
"cell_type": "markdown",
302+
"metadata": {},
303+
"source": [
304+
"## Numpy\n",
305+
"The Numpy package is a powerful N-dimensional array object, whic allows you to do do fast operations with vectors and N-dimensional matrices. It is in particular useful for tasks which invlove linear algebra, Fourier transforms, and random number generation.\n",
306+
"<br>\n",
307+
"<img src=\"images/numpy_example.png\" alt=\"Numpy example\" style=\"width: 600px;\"/>"
308+
]
309+
},
310+
{
311+
"cell_type": "markdown",
312+
"metadata": {},
313+
"source": [
314+
"## Scipy\n",
315+
"SciPy builds on Numpy and provides a large number of functions that operate on numpy arrays and are useful for scientific and engineering applications.\n",
316+
"<br>\n",
317+
"<img src=\"images/scipy_example_1.png\" alt=\"Scipy example 1\" style=\"width: 600px;\"/>\n",
318+
"<br>\n",
319+
"<img src=\"images/scipy_example_2.png\" alt=\"Scipy example 2\" style=\"width: 400px;\"/>\n",
320+
"<br>\n",
321+
"<img src=\"images/scipy_example_3.png\" alt=\"Scipy example 3\" style=\"width: 400px;\"/>"
322+
]
323+
},
324+
{
325+
"cell_type": "markdown",
326+
"metadata": {},
327+
"source": [
328+
"## Matplotlib\n",
329+
"Matplotlib is a plotting package, which allows you to visualize your data.\n",
330+
"<br>\n",
331+
"<img src=\"images/matplotlib_example.png\" alt=\"Matplotlib example\" style=\"width: 600px;\"/>"
332+
]
333+
},
334+
{
335+
"cell_type": "markdown",
336+
"metadata": {},
337+
"source": [
338+
"## Pandas\n",
339+
"The Pandas package offers data structures and operations for manipulating numerical tables and time series.\n",
340+
"<br>\n",
341+
"<img src=\"images/Pandas_example.png\" alt=\"Pandas example\" style=\"width: 600px;\"/>"
342+
]
343+
}
344+
],
345+
"metadata": {
346+
"kernelspec": {
347+
"display_name": "Python 3",
348+
"language": "python",
349+
"name": "python3"
350+
},
351+
"language_info": {
352+
"codemirror_mode": {
353+
"name": "ipython",
354+
"version": 3
355+
},
356+
"file_extension": ".py",
357+
"mimetype": "text/x-python",
358+
"name": "python",
359+
"nbconvert_exporter": "python",
360+
"pygments_lexer": "ipython3",
361+
"version": "3.7.4"
362+
}
363+
},
364+
"nbformat": 4,
365+
"nbformat_minor": 2
366+
}

0 commit comments

Comments
 (0)