List Comprehensions and Lambda Functions

In this mission, you’ll learn about concepts such as working with data in JavaScript Object Notation, list comprehensions, lambda functions, and more to turbo-charge working with data in Python.

One of the places that the JSON format is commonly used is in the results returned by an Application programming interface (API). APIs are interfaces used to send and transmit data between different computer systems. If you’d like to learn how to work with APIs, you can check out API course as well. Along with working with JSON data, you will also learn about the json library. The library provides functions that enable you to work with JSON data while using Python code. You will also learn what list comprehensions are and how they can be used to clean up your code and make it easier to read. List comprehensions can be used to: iterate over values in a list, perform a transformation on those values, and assign the result to a new list — all on one line of code! After you learn about list comprehensions, you will learn about lambda functions which are defined as temporary functions that can be declared in a single line of code.

In this mission, you will work with data from Hacker News to give a thorough overview of regular expressions and how powerful they can be in your data cleaning tasks. Because you’ll be working with real-world data, you will have the opportunity to think like a data analyst or data scientist as you explore a dataset. By the end of this mission, you will have a better working knowledge of list comprehensions and lambda functions and how to use them to do some powerful data cleaning.


  • Read and work with JSON files.
  • Learn to use list comprehensions to easily create and transform lists.
  • Learn to create and use lambda functions.

Lesson Outline

  1. The JSON Format
  2. Reading a JSON file
  3. Deleting Dictionary Keys
  4. Writing List Comprehensions
  5. Using List Comprehensions to Transform and Create Lists
  6. Using List Comprehensions to Reduce a List
  7. Passing Functions as Arguments
  8. Lambda Functions
  9. Using Lambda Functions to Analyze JSON data
  10. Reading JSON files into pandas
  11. Exploring Tags Using the Apply Function
  12. Extracting Tags Using Apply with a Lambda Function
  13. Next Steps
  14. Takeaways

Get started for free

No credit card required.

Already have an account? Sign in →

By creating an account you agree to accept our terms of use and privacy policy.