The Python programming language is increasingly popular. It is a versatile language for general purpose programming and accessible for novice programmers. However, it is also increasingly used for data science applications. This training introduces modules that are useful in that context.
Learning outcomes
When you complete this training you will
- be able to use pandas to represent, compute with and query data;
- be able to visualize data with seaborn and holoviews;
- be able to create data visualizations with matplotlib and bokeh;
- be able to parse textual information using regular expressions;
- be able to interact with relational databases using SQLAlchemy;
- be able to extract information from web pages using beautiful soup;
- be able to represent and query geographical information using geopandas.
Schedule
Total duration: 4 hours.
| Subject | Duration |
|---|---|
| introduction and motivation | 5 min. |
| pandas & seaborn or polars & seaborn | 105 min. |
| coffee break | 10 min. |
| text parsing with regular expressions | 40 min. |
| querying relational databases | 30 min. |
| web scraping | 10 min. |
| geographical information with geopandas | 30 min. |
| wrap up | 10 min. |
Training materials
Slides are available in the GitHub repository, as well as example code and hands-on material.
Target audience
This training is for you if you need to use Python for data analysis.
Prerequisites
You will need experience programming in Python. This is not a training that starts from scratch. Familiarity with numpy is not required, but would be beneficial.
If you plan to do Python programming in a Linux or HPC environment you should be familiar with these as well.
More concretely, participants should already be comfortable with the following:
- running Python code in Jupyter or from the command line;
- variables, numbers, strings, booleans, and basic containers such as lists, tuples, sets, and dictionaries;
if/elsestatements andforloops;- writing and calling simple functions with arguments and a return value;
- indexing and slicing sequences;
- importing modules and calling functions from them;
- reading and making small changes to short Python scripts;
- basic string handling and simple file-oriented workflows such as reading or writing CSV-like data.
You do not need prior experience with pandas, polars, seaborn, HoloViews, regular expressions, SQLAlchemy, Beautiful Soup, GeoPandas, DuckDB, or xarray. Those are part of the training itself.
Quick self-assessment
If you can do most of the tasks below without looking up basic Python syntax, you are likely ready for this training.
- write a function that returns all negative numbers from a list;
- loop over rows in a small CSV file and count how often a value occurs;
- use
if/elseto classify a measurement as low, normal, or high; - extract a slice from a list or string and explain what it contains;
- import a module such as
csv,math, orpathliband call one of its functions; - build a dictionary that maps names to values and retrieve one by key;
- read a short script that uses a function, a loop, and a few imports without needing every line explained;
- make a small change to an example notebook or script and run it again.
If several of these items still feel difficult, the training will probably move too fast. In that case, it is better to first take a short introductory Python course or refresh the basics.
Software and access requirements
For following along hands-on, you need
- laptop or desktop with internet access.
- a system set up so you can connect to an HPC system, an account on an HPC system (e.g., VSC, CECI, …), compute credits if that is required to run jobs on the HPC system if you want to use an HPC system;
- a Python environment that can run Jupyter Lab if you want to use your own system;
- access to Google Colaboratory if you prefer not to install software.
Level of the Material
For participants who already have basic Python programming experience, the material in this training is approximately
- Introductory: 30 %
- Intermediate: 50 %
- Advanced: 20 %
These percentages describe the level of the data science topics covered in the training, not the required entry level in Python itself.
Trainer(s)
- Geert Jan Bex (geertjan.bex@uhasselt.be)