
An illustration of collectible toys. MidJourney 5
Yesterday we ran a complete workflow, from a file on the course website to a finished chart, to get a sense of what python syntax looks like and to meet the libraries and commands that make up the python data science stack. Today we will slow down and spend the whole day on the first two steps of yesterdayβs workflow, Import and Explore.
Import is getting a file into pandas as a DataFrame, whether the file sits on your own computer or at a URL somewhere out on the internet. Explore is what you should do with any new dataset before you compute a single number from it: how many rows and columns you have, what type pandas gave each column, where the gaps are, and which columns have the same value all the way down. Exploring costs you a few minutes at the start, but the time is well-spent to avoid problems later in your data science workflow.
We will also meet pythonβs two essential containers, lists and dictionaries. We use both of them all over python to store structured data. Today each of them has one specific job: we will use a list to name a set of columns we want to keep, and, separately, a dictionary to say what some other columns should be renamed to. We will use them that way for most of the day, and then in the last session we will slow down and look at both containers on their own terms. Lists and dictionaries, like all python objects, have a lot of cool features we can put to use!
Class materials
| Session | Session 1 | Session 2 |
|---|---|---|
| day 2 / morning | πΌ Reading Data into pandas | π Exploring a DataFrame |
| day 2 / afternoon | π Five Claims About a Dataset Youβve Never Seen | π Lists & Dictionaries, On Their Own Terms |
End-of-day practice
Yesterdayβs analysis used one column out of the twenty-one in the Toolik weather file. Before you leave today you will go back to the rest of that file and write a data biography of it: what it covers, what condition it is in, and what a colleague should check before trusting a number computed from it. Every claim in your biography must be backed by a cell that produced it, which is what the morning sessions are practice for.