π» 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_normalize
to flatten nested JSON data from a data source you have not seen before.Practice using
DataFrame.explode
to expand lists in a column.Practice using
pd.merge
to combine dataframes.Learn about the
groupby
method 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,
cd
to theds105a-2024
folder and rungit pull --force
in your terminal to get the latest version of the courseβs repository.The
--force
here 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_normalize
to flatten nested JSON data.Using
DataFrame.explode
to expand lists in a column.Using
pd.merge
to combine dataframes.Using the
groupby
method in pandas.