Practical Python programming for scientists, 2 credits

Praktisk Pythonprogrammering för forskare


Language of instruction: English
Course period: 08/01/2024 - 16/02/2024
Course structure: On site is strongly encouraged for the benefits of interactivity. Digital participation possible upon request.


Students should have a basic knowledge of Python programming. This could be achieved by taking any of the many free online introductory courses.


  • Feel comfortable applying Python to your own research.
  • Awareness of how Python can be used to aid research.
  • Know how to use Python for data analysis and automation.
  • The ability to debug and fix issues with code as they arise.
  • Knowledge on how to make use of many existing tools such as Integrated development environments (IDEs), Jupyter Notebooks, linters and version control systems to help coding.
  • Become better at writing clean code that is easier to read and debug.
  • The ability to write python collaboratively and share your work.


The course supports learning outcomes A2 and B1 from PhD students individual study Plans (ISP) which are cited below.

A2. Visa förtrogenhet med vetenskaplig metodik i allmänhet och med det specifika forskningsområdets metoder i synnerhet.
B1. Visa förmåga till vetenskaplig analys och syntes samt till självständig kritisk granskning och bedömning av nya och komplexa företeelser, frågeställningar och situationer.


This course is designed to take researchers with limited Python programming knowledge and give them the skills and the confidence to start applying Python to their own research. This course will cover:

  • A review of the fundamentals.
  • A complete guide on how to setup Python to work on a new or existing project, this includes using virtual environments, an integrated development environment (IDE), Jupyter notebooks, AI tools (e.g., ChatGPT, GitHub copilot) and using git/GitHub.
  • Data analysis and visualisation with python using some of the major libraries for scientific analysis (pandas, NumPy, SciPy, matplotlib/seaborn).
  • Automating repetitive tasks such as reading data from files.
  • How to debug your code and how to write tests to know your code is doing what it “should” be doing.
  • Bad Python programming practices and what you can do instead.
  • Collaborative coding and sharing your research online.


The course will be split into parts. First, there will be a 1-week long course that is full-time. The first half of the morning will be reserved for providing a lecture covering the selected topic(s) of the day as well as recapping what was learned yesterday. The rest of the day will be devoted to interactive sessions with students working in small groups (~3) to solve coding exercises which get progressively more complex.

After this course, students will be given 5 weeks to complete an assignment in which they apply Python to their own research (arrangements will be made for students that do not have any research to work on). During these 5 weeks, we will meet once a week for a 1 hour workshop to discuss progress and any current issues. Finally, each student will present their project results as part of a whole day symposium.


Examination is based on attendance (50%) and a final project (50%). The final project can either be to complete a project in which they apply Python to their own research or in cases where this is not possible, an alternative project will be provided. If a student selects to apply Python to their own research, they can select something that suits them (upon agreement with the examiner). This could for example be analysing some newly generated data or automating some data analysis that the student previously used excel to do. The final project results will be presented as part of a seminar.


Rory Crean,


Department of Chemistry - BMC


Rory Crean,
Mikael Widersten,


Submit the application for admission to: Application
Submit the application not later than: 15/12/2023

Last modified: 2023-11-17