
A panda, comparing two stacks of the same thing. MidJourney 5
For five days every question weโve asked was a question about one table. We got away with it because somebody (your kind and generous instructional team) had already put everything you needed in 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 laid out at right angles to the question you want to ask. Before you can analyse any of that, you have to change its shape.
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. One step stacks many tables top to bottom. One step takes a single table and rotates it. None of them actually calculates anything! However, without them most of what you learned last week cannot be applied to real files.
This afternoon you meet the column that is hardest to get into the right shape, get a little deeper into the weeds about the python everything-is-an-object paradigm, and meet 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, Sixty-Six 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 find a number of reasons to be wary of easy answers.