π» Week 07 Lab
Practice reshaping dataframes
πLocation: Friday, 15 November 2024. Time varies.
π₯ Learning Objectives
We want you to learn/practice the following goals in this lab:
Practice using
pd.json_normalizeto flatten nested JSON data from a data source you have not seen before.Practice using
DataFrame.explodeto expand lists in a column.Practice using
pd.mergeto combine dataframes.Learn about the
groupbymethod in pandas.
π Preparation
- Attend (or rewatch) the Week 07 lecture.
NOTE: The skills you are practising today will be essential for the βοΈ W10 Summative assignment.
π£οΈ Roadmap
Here is how we will achieve the goal for this lab:
Part I: βοΈ Set Up (10 min)
Use either the VSCode on your own machine or the one inside
Nuvolos.
π― INDIVIDUAL ACTION POINTS
There are two options to download the lab notebook:
(Simpler) Click on the link below to download the lab notebook directly.
(GitHub pro) If you have already forked the courseβs live repository,
lse-ds105/ds105a-2024,
cdto theds105a-2024folder and rungit pull --forcein your terminal to get the latest version of the courseβs repository.The
--forcehere is to ensure that your local repository is updated with the latest changes from the courseβs repository and it will completely ignore any local changes you have made (even if you had committed them). Donβt use βforce in other contexts unless you know what you are doing.Navite to where the W07 Lab notebook is located and open it.
Part II: π Practice (70-80 min)
Follow the instructions in the lab notebook to complete the exercises.
Notes:
- You can work alone or in small groups for this.
- If you want, feel free to play a game of π§ββοΈ Pilot and π Copilot (s) like weβve done in the past.
What the exercises will cover:
Using
pd.json_normalizeto flatten nested JSON data.Using
DataFrame.explodeto expand lists in a column.Using
pd.mergeto combine dataframes.Using the
groupbymethod in pandas.
