
Today we run a complete data science workflow together, from a data file on the course website to a finished chart. Weβre jumping into the whole workflow on the very first day, before we learn how the individual pieces work, so that you get an early sense of where we are going and of the overall structure and rhythm of python and its data science libraries.
This morning has two parts. First we meet python in Positron, which is the application we will write every line of code in for the duration of the course (and, likely, for much of your year in the MEDS program). The version of Positron we will be using runs in a browser on the Bren server, so there is nothing for you to install. Then we will cover just enough Python βgrammarβ to read the afternoonβs code: what a variable is, what a string is, and how to use print statements.
In the afternoon we will analyze a single file of daily Arctic weather, recorded at Toolik Lake in Alaska between June 1988 and December 2018. By the end of the day, you will have imported that file, explored it, grouped it, aggregated it, drawn a chart from it, and exported the result. We do not clean the dataset, because the one column we analyze has no missing values. We will spend all of Day 4 on cleaning. Some of the afternoon will probably feel like copy-and-paste, and much of it will feel foreign (which is fine, and expected!), though you will write one thing yourself: the f-string you learn in the morning session. Today is only an introduction, and none of it has to stick yet. By the end of the course, the commands and tools we use today should feel familiar.
Class materials
| When | First session | Second session |
|---|---|---|
| day 1 / morning | βοΈ Positron & Jupyter Notebooks | π Python Essentials: Variables, Strings & f-strings |
| day 1 / afternoon | π¬ The Python Data Science Workflow, Part 1: Import to Aggregate | π¬ The Python Data Science Workflow, Part 2: Visualize, Export & Name the Workflow |
End-of-day practice
Before you leave today, we encourage you to run the same workflow again on your own, changing a few things just to see what happens. Nobody expects you to understand every line yet! If something breaks and you cannot work out why, come and find Cella or Kelly. Today we are learning a valuable skill: reading working code, tinkering with it, and changing it on purpose to get a new result. Reading and tinkering with code you did not write is something you will do every day for the rest of the course, and for most of a career in data science.
Additional Resources
- The Data Science Workflow: the ten steps, and where you will learn each one
- Setting up Python: only if you want Python on your own laptop as well. Our course runs entirely on the Bren server, so you do not need to install anything.
- Positron cheatsheet
- First steps in Python
- Reading Python errors: what a traceback is telling you. We do not cover errors in a session of their own, so save this link for the first error you hit on your own.