Introduction to Python for Data Science

KAUST Visualization Core Lab

30 March 2020

8:30 am - 5:00 pm

Instructors: David R. Pugh

Helpers: Glendon Holst

General Information

The KAUST Visualization Lab is hosting an Introduction to Python for Data Science workshop. Visualization lab staff will provide an introduction to Python for data science designed for learners with little or no previous programming experience. Topics covered will include

This hands-on lesson is part of the Introduction to Data Science Workshop Series being offered by the KAUST Research Computing Core Labs as part of our on-going efforts to build capacity in core data science skills at KAUST. The workshop curriculum largely follows the curriculum developed by Software Carpentry, a volunteer project dedicated to helping researchers get their work done in less time and with less pain by teaching them basic research computing skills.

This is a live-coding based workshop and learners are expected to bring their own laptops with the required software already downloaded and installed.

For more information on what Software Carpentry teaches and why, please see their paper "Best Practices for Scientific Computing".

Who: The course is aimed at graduate students (MSc and PhD), Post-docs, faculty and other research staff at KAUST. You don't need to have any previous knowledge of the tools that will be presented at the workshop.

Where: Auditorium 215 (between bldg. 2-3, level 0). Get directions with OpenStreetMap or Google Maps.

When: 30 March 2020. Add to your Google Calendar.

Registration: Register Now!

Requirements: Participants must bring a laptop with a Mac, Linux, or Windows operating system (not a tablet, Chromebook, etc.) that they have administrative privileges on. They should have a few specific software packages installed (listed below).

Accessibility: We are committed to making this workshop accessible to everybody. The workshop organizers have checked that:

Materials will be provided in advance of the workshop and large-print handouts are available if needed by notifying the organizers in advance. If we can help making learning easier for you (e.g. sign-language interpreters, lactation facilities) please get in touch (using contact details below) and we will attempt to provide them.

Contact: Please email for more information.

Code of Conduct

Everyone who participates in Carpentries activities is required to conform to the Code of Conduct.This document also outlines how to report an incident if needed.

Collaborative Notes

We will use this collaborative document for chatting, taking notes, and sharing URLs and bits of code.


Please be sure to complete these surveys before and after the workshop.

Pre-workshop Survey

Post-workshop Survey


Before Pre-workshop survey
09:00 Introduction to Python
10:30 Morning break
10:45 Introduction to Pandas
12:00 Lunch break
13:00 Building Programs with Python
14:30 Afternoon break
14:45 Python Programming "Best Practices"
16:30 Wrap-up
17:00 END
After Post-workshop survey


Programming in Python

  • Running and Quiting
  • Variables and Assignment
  • Data Types and Type Conversion
  • Built-in Functions and Help
  • Libraries
  • Reading Tabular Data into DataFrames
  • Pandas DataFrames
  • Lists
  • For Loops
  • Looping Over Data Sets
  • Writing Functions
  • Variable Scope
  • Conditionals
  • Programming Style
  • Reference...


To participate in a Software Carpentry workshop, you will need access to the software described below. In addition, you will need an up-to-date web browser.

We maintain a list of common issues that occur during installation as a reference for instructors that may be useful on the Configuration Problems and Solutions wiki page.

Text Editor

When you're writing code, it's nice to have a text editor that is optimized for writing code, with features like automatic color-coding of key words. The default text editor on macOS and Linux is usually set to Vim, which is not famous for being intuitive. If you accidentally find yourself stuck in it, hit the Esc key, followed by :+Q+! (colon, lower-case 'q', exclamation mark), then hitting Return to return to the shell.

Visual Studio Code is a source-code editor developed by Microsoft for Windows, Linux and macOS. It includes support for debugging, embedded Git control and GitHub, syntax highlighting, intelligent code completion, snippets, and code refactoring. It is highly customizable, allowing users to change the theme, keyboard shortcuts, preferences, and install extensions that add additional functionality. The source code is free and open source and released under the permissive MIT License.


Python is a popular language for research computing, and great for general-purpose programming as well. While there are many different ways to install Python, we recommend installing the 64-bit Python 3 version of Miniconda.

We will teach Python using the JupyterLab, a programming environment that runs in a web browser. For this to work you will need a reasonably up-to-date browser. The current versions of the Chrome, Safari and Firefox browsers are all supported.

  1. Open with your web browser.
  2. Download the 64-bit Python 3 installer for Windows.
  3. Install Python 3 using all of the defaults for installation except make sure to check Add Miniconda to my PATH environment variable.
  1. Open with your web browser.
  2. Download the 64-bit Python 3 installer for Linux. The installation requires using the shell. If you aren't comfortable doing the installation yourself stop here and request help at the workshop.
  3. Open a terminal window.
  4. Type
    bash Miniconda3-
    and then press Tab. The name of the file you just downloaded should appear. If it does not, navigate to the folder where you downloaded the file, for example with:
    cd ~/Downloads
    Then, try again.
  5. Press Return. You will follow the text-only prompts. To move through the text, press Spacebar. Type yes and press enter to approve the license. Press enter to approve the default location for the files. Type yes and press enter to prepend Miniconda to your PATH (this makes the Miniconda distribution the default Python).
  6. Close the terminal window.