Extension for `pandas` to use `rapidfuzz` for fuzzy matching.
Project description
pandas-fuzz
Extension for pandas
to use rapidfuzz
for fuzzy matching.
Requirements
- Python 3.9 or later
- On Windows the Visual C++ 2019 redistributable is required
Installation
pip install pandas_fuzz
Usage
To register the extension make sure to import pandas_fuzz
before using it.
import pandas as pd
import pandas_fuzz
Alternatively, you can import pandas
from pandas_fuzz
directly.
from pandas_fuzz import pandas as pd
rapidfuzz.fuzz
pandas_fuzz
integrates the following functions from rapidfuzz.fuzz
into pandas
. These functions are available in the fuzz
namespace for both pandas.Series
and pandas.DataFrame
.
rapidfuzz.fuzz.ratio
rapidfuzz.fuzz.partial_ratio
rapidfuzz.fuzz.token_sort_ratio
rapidfuzz.fuzz.token_set_ratio
rapidfuzz.fuzz.WRatio
rapidfuzz.fuzz.QRatio
pandas.Series
apply fuzz.ratio
element wise to pd.Series
.
>>> pd.Series(["this is a test", "this is a test!"]).fuzz.ratio("this is a test!")
0 96.551724
1 100.000000
dtype: float64
pandas.DataFrame
apply fuzz.ratio
row wise to columns s1
and s2
>>> pd.DataFrame({
"s1": ["this is a test", "this is a test!"],
"s2": ["this is a test", "this is a test!"]
}).fuzz.ratio("s1", "s2")
0 100.0
1 100.0
dtype: float64
Dependencies
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pandas_fuzz-0.1.1.tar.gz
(3.6 kB
view hashes)
Built Distribution
Close
Hashes for pandas_fuzz-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb259e1f32528437fbe8feb1464bb1eb5b918d518c34eab8afd40365d85e6770 |
|
MD5 | 4f5c5d1fdfcc2438fe4bef128e3b585e |
|
BLAKE2b-256 | 858ede25b4988a2a6cfa01e0fb9a94e40e7483fe8a05478c2587806d48827111 |