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

bookChallenge: Fuzzy Match Product Names

Task

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.

Solution

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 1. ChapterΒ 3
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our 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

Swipe to show menu

Task

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.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 1. ChapterΒ 3
single

single

some-alt