πŸ§‘β€πŸ« Week 01, Day 02 - Lecture

Working with Data Types and APIs

Author

Dr Jon Cardoso-Silva

Last updated

15 July 2025

πŸ₯… Learning Objectives
By the end of this session, you should be able to: i) Explain how different data types (integers, floats, strings) are represented in a computer, ii) Justify the use of NumPy for numerical operations and pandas for structured data, iii) Convert common Python objects (lists, dictionaries) into pandas DataFrames, iv) Use the requests library to fetch data from a web API, v) Transform a semi-structured JSON response into a structured pandas DataFrame.
ME204 course icon

⏰ Date and Time: Tuesday, 15 July 2025 | 10.00am - 1.00pm πŸ“ Location: CKK.2.06 (see LSE’s πŸ—ΊοΈ campus map)

Welcome back!

Yesterday, we mapped out a data workflow at a conceptual level and in the afternoon, you revisited some basic Python concepts. Today, we will acquire data from an API and transform it into a DataFrame, the most standard way to store data for analysis.

We will also revisit the question from yesterday: could we get an AI to do the whole data processing and data analysis for us?

πŸ—£οΈ Lecture Overview

Today’s session is a journey from a high-level question to the technical details needed to answer it properly:

  1. Why Data Types Matter: We’ll look under the hood to see how computers actually store data, and why this is fundamental to efficient data analysis.
  2. From Lists to DataFrames: We’ll see why managing multiple lists is cumbersome and how numpy and pandas provide a more powerful solution.
  3. Getting Data from APIs: We’ll learn what an API is and use one to fetch the live weather data we need to really answer our question.

🎬 Lecture Slides

Use your keyboard arrows to navigate the slides below. The first part of the slides will explain how computers store the data we’re about to work with. You can also view them in fullscreen.

Prefer a PDF? Download the slides here:

(Sometimes the PDF export is a bit buggy and some text may appear with different formatting.)

After the Lecture

You are now equipped with the β€œwhy”. The lab session this afternoon is your chance to get hands-on with the β€œhow”.

πŸ’» Today’s Lab

Your main task for the afternoon.

➑️ Go to Lab Instructions

Questions?

➑️ Ask on Slack

```