Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Fuzzy Match Product Names | Fuzzy Matching and Similarity Detection
Quizzes & Challenges
Quizzes
Challenges
/
Data Cleaning Techniques in Python

bookChallenge: Fuzzy Match Product Names

Opgave

Swipe to start coding

You are given two lists of product names:

  • catalog_names — the official catalog entries;
  • incoming_names — names provided by an external supplier with slight variations.

Your goal is to assign each supplier product name to the closest matching catalog name using the difflib library from the Python standard library.

Follow these steps:

  1. For each element of incoming_names, compare it with every element of catalog_names.
  2. Use the SequenceMatcher class from the difflib module to calculate similarity scores.
  3. For each incoming name, find the catalog entry with the highest similarity score.
  4. Store all matches in a dictionary named matched_products, where keys are supplier names and values are the closest catalog names.

Make sure that the variable matched_products is declared and contains the correct matches.

Løsning

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 3
single

single

Spørg AI

expand

Spørg AI

ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

Suggested prompts:

Can you explain this in simpler terms?

What are the main benefits or drawbacks?

Can you give me a real-world example?

close

bookChallenge: Fuzzy Match Product Names

Stryg for at vise menuen

Opgave

Swipe to start coding

You are given two lists of product names:

  • catalog_names — the official catalog entries;
  • incoming_names — names provided by an external supplier with slight variations.

Your goal is to assign each supplier product name to the closest matching catalog name using the difflib library from the Python standard library.

Follow these steps:

  1. For each element of incoming_names, compare it with every element of catalog_names.
  2. Use the SequenceMatcher class from the difflib module to calculate similarity scores.
  3. For each incoming name, find the catalog entry with the highest similarity score.
  4. Store all matches in a dictionary named matched_products, where keys are supplier names and values are the closest catalog names.

Make sure that the variable matched_products is declared and contains the correct matches.

Løsning

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 3
single

single

some-alt