Fuzzy String Matching
This skill demonstrates how to use fuzzy string matching to find company or fund names in a dataset.
Requirements
fuzzywuzzyorrapidfuzzpython-Levenshtein(optional but recommended for speed)
Installation
pip install rapidfuzz
Usage
import pandas as pd
from rapidfuzz import process, fuzz
df = pd.read_csv('data.tsv', sep='\t')
names = df['NAME_COLUMN'].dropna().unique()
# Find the best match
query = "Renaissance Technologies"
best_match = process.extractOne(query, names, scorer=fuzz.token_sort_ratio)
print(f"Best match: {best_match[0]} with score {best_match[1]}")