Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Challenge: Deduplicate a Customer List | Deduplication Strategies
Quizzes & Challenges
Quizzes
Challenges
/
Data Cleaning Techniques in Python

bookChallenge: Deduplicate a Customer List

Taak

Swipe to start coding

You are given a list of customer records that contains duplicate entries. Each customer is represented as a dictionary with two fields:

  • name — the customer's full name;
  • email — the email address provided by the customer.

Your goal is to remove duplicate records using a simple matching rule.

Follow these steps:

  1. Two records are considered duplicates if their email fields match exactly.
  2. Create an empty dictionary named unique_customers, where keys are email addresses and values are customer dictionaries.
  3. Loop through the input list customers and add only the first occurrence of each email to unique_customers.
  4. Store the deduplicated list in a new variable named deduplicated_list, which should contain only the unique customer dictionaries (values of unique_customers).

Make sure both unique_customers and deduplicated_list are declared and contain the correct deduplicated data.

Oplossing

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 3
single

single

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

close

bookChallenge: Deduplicate a Customer List

Veeg om het menu te tonen

Taak

Swipe to start coding

You are given a list of customer records that contains duplicate entries. Each customer is represented as a dictionary with two fields:

  • name — the customer's full name;
  • email — the email address provided by the customer.

Your goal is to remove duplicate records using a simple matching rule.

Follow these steps:

  1. Two records are considered duplicates if their email fields match exactly.
  2. Create an empty dictionary named unique_customers, where keys are email addresses and values are customer dictionaries.
  3. Loop through the input list customers and add only the first occurrence of each email to unique_customers.
  4. Store the deduplicated list in a new variable named deduplicated_list, which should contain only the unique customer dictionaries (values of unique_customers).

Make sure both unique_customers and deduplicated_list are declared and contain the correct deduplicated data.

Oplossing

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 3
single

single

some-alt