
A panda, comparing two stacks of the same thing. MidJourney 5
For the first five days of our Python journey, weβve limited ourselves to what we can do with a single table. We got away with it because somebody (your kind and generous instructional team??) had already wrangled everything you needed into one place.
Suffice to say, that is not how data usually arrives. Instead it shows up on your doorstep as a grab bag of files that describe the same thing from different angles, or as thirty files that describe different things in the same format, or as one file organized at right angles to the question you want to ask. So often, before you can even begin your analyses, you have to build your very own Frankendataset!
Today we will learn the three steps that take a big βol bag-o-data (tm) and turn it into a dataframe you can actually use. One step puts two tables side by side. Another step stacks many tables top to bottom. A third step takes a single table and rotates it. None of these steps actually calculate anything! However, without themβ¦ most of what you learned last week cannot be applied to real files.
In addition to learning how to put together datasets, this afternoon you finally meet the data type that is hardest to get into the right format and structure⦠your new best frenemy: datetime.
Class materials
| Session | Session 1 | Session 2 |
|---|---|---|
| day 6 / morning | π The Join Pattern | π§© Long and Wide |
| day 6 / afternoon | π A Date Is Not a Number | π Two Records, Seventy-Eight Years Apart |
End-of-day practice
Our final activity today delves into the highs and lows (pitches, natch) of sixty-four years of the Eurovision Song Contest. We will put the dayβs three reshaping moves to work on it. And, as usual, we will find a number of reasons to be wary of easy answers.