Introduction to Python for Data Science

This lesson is an introduction to programming in Python for people with little or no previous programming experience. It uses plotting as its motivating example, and is designed to be used in both Data Carpentry and Software Carpentry workshops. This lesson references JupyterLab, but can be taught using a regular Python interpreter as well. Please note that this lesson uses Python 3 rather than Python 2.

Under Design

This lesson is currently in its early design stage; please check the design notes to see what we have so far. Contributions are very welcome: we would be particularly grateful for exercises and for commentary on the ones already there.


  1. Learners need to understand what files and directories are, what a working directory is, and how to start a Python interpreter.

  2. Learners must install Python before the class starts.

  3. Learners must get the gapminder data before class starts: please download and unzip the file

    Please see the setup instructions for details.


Setup Download files required for the lesson
09:00 1. Getting Started with Conda Why should I use a package and environment management system?
What is Conda?
How should I organize my project directory?
09:20 2. Running and Quitting How can I run Python programs?
09:35 3. Variables and Assignment How can I store data in programs?
09:55 4. Data Types and Type Conversion What kinds of data do programs store?
How can I convert one type to another?
10:15 5. Built-in Functions and Help How can I use built-in functions?
How can I find out what they do?
What kind of errors can occur in programs?
10:40 6. Morning Coffee Break
10:55 7. Libraries How can I use software that other people have written?
How can I find out what that software does?
11:15 8. Reading Tabular Data into DataFrames How can I read tabular data?
11:35 9. Pandas DataFrames How can I do statistical analysis of tabular data?
12:05 10. Plotting How can I plot my data?
How can I save my plot for publishing?
12:35 11. Lunch Break
13:20 12. Lists How can I store multiple values?
13:40 13. For Loops How can I make a program do many things?
14:05 14. Conditionals How can programs do different things for different data?
14:30 15. Looping Over Data Sets How can I process many data sets with a single command?
14:45 16. Afternoon Coffee Break
15:00 17. Writing Functions How can I create my own functions?
15:25 18. Variable Scope How do function calls actually work?
How can I determine where errors occurred?
15:45 19. Programming Style How can I make my programs more readable?
How do most programmers format their code?
How can programs check their own operation?
16:15 20. Wrap-Up What have we learned?
What else is out there and where do I find it?
16:35 21. Feedback How did the class go?
16:50 Finish

The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.