🌐
PyPI
pypi.org › project › fuzzywuzzy
fuzzywuzzy · PyPI
pip install fuzzywuzzy Copy PIP instructions · Latest release · Released: Feb 13, 2020 · Fuzzy string matching in python · These details have been verified by PyPI · seatgeek · These details have not been verified by PyPI · Homepage · License: GNU General Public License v2 (GPLv2) (GPLv2) Author: Adam Cohen ·
      » pip install fuzzywuzzy
    
Published   Feb 13, 2020
Version   0.18.0
🌐
GitHub
github.com › seatgeek › fuzzywuzzy
GitHub - seatgeek/fuzzywuzzy: Fuzzy String Matching in Python · GitHub
Fuzzy String Matching in Python. Contribute to seatgeek/fuzzywuzzy development by creating an account on GitHub.
Starred by 9.3K users
Forked by 859 users
Languages   Python 91.7% | Shell 8.3%
🌐
GeeksforGeeks
geeksforgeeks.org › python › fuzzywuzzy-python-library
FuzzyWuzzy Python Library - GeeksforGeeks
January 9, 2026 - FuzzyWuzzy is a Python library for fuzzy string matching that uses Levenshtein Distance to compare two strings and returns a similarity score from 0 to 100.
🌐
Medium
medium.com › @alphaiterations › fuzzy-matching-with-fuzzywuzzy-a-comprehensive-guide-04873f07de31
Fuzzy Matching with FuzzyWuzzy: A Comprehensive Guide | by Alpha Iterations | Medium
April 30, 2024 - FuzzyWuzzy, a powerful Python library, provides tools for comparing and matching strings based on their similarity.
🌐
Analytics Vidhya
analyticsvidhya.com › home › fuzzywuzzy python library: interesting tool for nlp and text analytics
FuzzyWuzzy Python Library: Interesting Tool for NLP and Text Analytics
October 16, 2024 - The FuzzyWuzzy python library uses Levenshtein distance to calculate the difference between two strings. Let's understand it
Find elsewhere
🌐
Typesense
typesense.org › posts › fuzzy string matching in python (with examples)
Fuzzy string matching in Python (with examples) | Typesense
Fuzzywuzzy is a more feature-rich library for computing string similarity and performing fuzzy string matching in Python.
🌐
Seatgeek
chairnerd.seatgeek.com › fuzzywuzzy-fuzzy-string-matching-in-python
FuzzyWuzzy: Fuzzy String Matching in Python - ChairNerd
July 8, 2011 - To achieve this, we’ve built up a library of “fuzzy” string matching routines to help us along. And good news! We’re open sourcing it. The library is called “Fuzzywuzzy”, the code is pure python, and it depends only on the (excellent) difflib python library.
🌐
FreshPorts
freshports.org › devel › py-fuzzywuzzy
FreshPorts -- devel/py-fuzzywuzzy: Fuzzy string matching using Levenshtein Distance
November 29, 2017 - Fuzzy string matching like a boss. It uses Levenshtein Distance to calculate the differences between sequences in a simple-to-use package. Simple Ratio >>> fuzz.ratio("this is a test", "this is a test!") 97 Partial Ratio >>> fuzz.partial_ratio("this is a test", "this is a test!") 100 Token ...
Top answer
1 of 4
48

Given your task your comparing 70k strings with each other using fuzz.WRatio, so your having a total of 4,900,000,000 comparisions, with each of these comparisions using the levenshtein distance inside fuzzywuzzy which is a O(N*M) operation. fuzz.WRatio is a combination of multiple different string matching ratios that have different weights. It then selects the best ratio among them. Therefore it even has to calculate the Levenshtein distance multiple times. So one goal should be to reduce the search space by excluding some possibilities using a way faster matching algorithm. Another issue is that the strings are preprocessed to remove punctuation and to lowercase the strings. While this is required for the matching (so e.g. a uppercased word becomes equal to a lowercased one) we can do this ahead of time. So we only have to preprocess the 70k strings once. I will use RapidFuzz instead of FuzzyWuzzy here, since it is quite a bit faster (I am the author).

The following version performs more than 10 times as fast as your previous solution in my experiments and applies the following improvements:

  1. it preprocesses the strings ahead of time

  2. it passes a score_cutoff to extractOne so it can skip calculations where it already knows they can not reach this ratio

import pandas as pd, numpy as np
from rapidfuzz import process, utils

org_list = df['org_name']
processed_orgs = [utils.default_process(org) for org in org_list]

for (i, processed_query) in enumerate(processed_orgs):
    # None is skipped by extractOne, so we set the current element to None an
    # revert this change after the comparision
    processed_orgs[i] = None
    match = process.extractOne(processed_query, processed_orgs, processor=None, score_cutoff=93)
    processed_orgs[i] = processed_query
    if match:
        df.loc[i, 'fuzzy_match'] = org_list[match[2]]
        df.loc[i, 'fuzzy_match_score'] = match[1]

Here is a list of the most relevant improvements of RapidFuzz to make it faster than FuzzyWuzzy in this example:

  1. It is implemented fully in C++ while a big part of FuzzyWuzzy is implemented in Python

  2. When calculating the levenshtein distance it takes into account the score_cutoff to choose an optimized implementation based. E.g. when the length difference between the strings is to big it can exit in O(1).

  3. FuzzyWuzzy uses Python-Levenshtein to calculate the similarity between two strings, which uses a weightened Levenshtein distance with a weight of 2 for substitutions. This is implemented using Wagner-Fischer. RapidFuzz on the other hand uses a bitparallel implementation for this based on BitPal, which is faster

  4. fuzz.WRatio is combining the results of multiple other string matching algorithms like fuzz.ratio, fuzz.token_sort_ratio and fuzz.token_set_ratio and takes the maximum result after weighting them. So while fuzz.ratio has a weighting of 1 fuzz.token_sort_ratio and fuzz.token_set_ratio have one of 0.95. When the score_cutoff is bigger than 95 fuzz.token_sort_ratio and fuzz.token_set_ratio are not calculated anymore, since the results are guaranteed to be smaller than the score_cutoff

  5. In process.extractOne RapidFuzz avoids calls through Python whenever possible and preprocesses the query once ahead of time. E.g. the BitPal algorithm requires one of the two strings which are compared to be stored into a bitvector which takes a big part of the algorithms runtime. In process.extractOne the query is stored into this bitvector only once and the bitvector is reused afterwards making the algorithm a lot faster.

  6. since extractOne only searches for the best match it uses the ratio of the current best match as score_cutoff for the next elements. This way it can quickly discard more elements by using the improvements to the levenshtein distance calculation from 2) in many cases. When it finds a element with a similarity of 100 it exits early since there can't be a better match afterwards.

2 of 4
5

This solution leverages apply() and should demonstrate reasonable performance improvements. Feel free to play around with the scorer and change the threshold to meet your needs:

import pandas as pd, numpy as np
from fuzzywuzzy import process, fuzz

df = pd.DataFrame([['cliftonlarsonallen llp minneapolis MN'],
        ['loeb and troper llp newyork NY'],
        ["dauby o'connor and zaleski llc carmel IN"],
        ['wegner cpas llp madison WI']],
        columns=['org_name'])

org_list = df['org_name']

threshold = 40

def find_match(x):

  match = process.extract(x, org_list, limit=2, scorer=fuzz.partial_token_sort_ratio)[1]
  match = match if match[1]>threshold else np.nan
  return match

df['match found'] = df['org_name'].apply(find_match)

Returns:

                                   org_name                                     match found
0     cliftonlarsonallen llp minneapolis MN             (wegner cpas llp madison WI, 50, 3)
1            loeb and troper llp newyork NY             (wegner cpas llp madison WI, 46, 3)
2  dauby o'connor and zaleski llc carmel IN                                             NaN
3                wegner cpas llp madison WI  (cliftonlarsonallen llp minneapolis MN, 50, 0)

If you would just like to return the matching string itself, then you can modify as follows:

match = match[0] if match[1]>threshold else np.nan

I've added @user3483203's comment pertaining to a list comprehension here as an alternative option as well:

df['match found'] = [find_match(row) for row in df['org_name']]

Note that process.extract() is designed to handle a single query string and apply the passed scoring algorithm to that query and the supplied match options. For that reason, you will have to evaluate that query against all 70,000 match options (the way you currently have your code setup). So therefore, you will be evaluating len(match_options)**2 (or 4,900,000,000) string comparisons. Therefore, I think the best performance improvements could be achieved by limiting the potential match options via more extensive logic in the find_match() function, e.g. enforcing that the match options start with the same letter as the query, etc.

🌐
PyPI Stats
pypistats.org › packages › fuzzywuzzy
fuzzywuzzy
PyPI page Home page Author: Adam Cohen License: GPLv2 Summary: Fuzzy string matching in python Latest version: 0.18.0 Optional dependencies: python-levenshtein Downloads last day: 568,840 Downloads last week: 3,614,607 Downloads last month: 15,367,611
🌐
LinkedIn
linkedin.com › pulse › let-data-work-you-thefuzz-fuzzywuzzy-resat-caner-bas
Let the Data Work for You: thefuzz (fuzzywuzzy)
September 4, 2023 - Hey there, business enthusiasts! Today, we're diving into the exciting world of Python and its magical tool, thefuzz (formerly known as FuzzyWuzzy). It's not a cuddly pet or a children's storybook character; instead, it's a powerful library that can transform your data-related challenges into opport
🌐
categitau
categitau.com › 2018 › 02 › 28 › fuzzy-string-matching-in-python.html
Fuzzy String Matching In Python | categitau
February 28, 2018 - Fuzzywuzzy is a python library that uses Levenshtein Distance to calculate the differences between sequences and patterns that was developed and also open-sourced by SeatGeek, a service that finds events from all over the internet and showcase them on one platform.
🌐
Pythonfix
pythonfix.com › pkg › f › fuzzywuzzy
fuzzywuzzy 0.18.0 - Fuzzy string matching in python - PythonFix.com
February 18, 2026 - Fuzzy string matching in python · 9269 Stars :star: Stars: 9269, Watchers: 9269, Forks: 870, Open Issues: 106 · The seatgeek/fuzzywuzzy repo was created 14 years ago and the last code push was 2 years ago. The project is extremely popular with a mindblowing 9269 github stars!
🌐
Aylakhan
aylakhan.tech › home> › data> › python text analysis tools: fuzzywuzzy’s basic string matching
Python text analysis tools: FuzzyWuzzy’s basic string matching – Ayla Khan
March 29, 2020 - The Python FuzzyWuzzy module uses Levenshtein edit distance to implement fuzzy string matching. FuzzyWuzzy’s matching tools return results on a scale from 0 to 100.
🌐
DataCamp
datacamp.com › tutorial › fuzzy-string-python
Fuzzy String Matching in Python Tutorial | DataCamp
January 15, 2026 - One of the most popular packages for fuzzy string matching in Python was historically FuzzyWuzzy. However, to resolve licensing issues and update the codebase, the project was renamed in 2021 to TheFuzz.
🌐
Neudesic
neudesic.com › blog › fuzzywuzzy-using-python
FuzzyWuzzy Using Python - Neudesic
July 2, 2024 - The FuzzyWuzzy library in Python was developed and open-sourced by Seatgeek to tackle the ticket search use case for their website.
🌐
Analytics Vidhya
analyticsvidhya.com › back-channel › download-pdf.php pdf
Fuzzy String Matching – A Hands-on Guide
from fuzzywuzzy import process query = 'My name is Ali' choices = ['My name Ali', 'My name is Ali', 'My Ali'] # Get a list of matches ordered by score, default limit to 5 process.extract(query, choices) If we want to extract out the top match, we can run the following code: ... Fuzzy string matching is a powerful technique for comparing and identifying similar text, even when there · are variations or errors. In Python, libraries like FuzzyWuzzy and Levenshtein provide efficient ways to
🌐
Alireza Zarrinmehr
alireza-zarrinmehr.com › what-is-fuzzywuzzy
What is FuzzyWuzzy? – Alireza Zarrinmehr
April 26, 2023 - FuzzyWuzzy is a popular Python library used for string matching and comparison.