Package: a-pandas-ex-fuzz
Intuitive way of using fuzz matching in pandasUpdates05.10.2022- Added compare rowsInstallation#Try it first like this:#rapidfuzz is a lot faster than fuzzywuzzy, but I had some problems installing it, #even with Visual C++ 2019 redistributable installed   a-pandas-ex-fuzz will try to import this module firstpipinstalla-pandas-ex-plode-toolpipinstalla-pandas-ex-df-to-stringpipinstallrapidfuzz#https://github.com/maxbachmann/RapidFuzzpipinstall--no-depsa-pandas-ex-fuzz#if rapidfuzz does not work, use:pipinstalla-pandas-ex-plode-toolpipinstalla-pandas-ex-df-to-stringpipinstallfuzzywuzzypipinstall--no-depsa-pandas-ex-fuzz#Or if you want to try to install everything:pipinstalla-pandas-ex-fuzzCompare values in column against each other: pandas.Series.s_fuzz_all_values_in_col()froma_pandas_ex_fuzzimportpd_add_fuzzy_matchingpd_add_fuzzy_matching()#adds three new methods to pd.importpandasaspddf=pd.read_csv("https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/titanic.csv")df11=df.Name.s_fuzz_all_values_in_column(limit=5,merge_with_series=True,partial_full_weighted="weighted")df22=df.Name.s_fuzz_all_values_in_column(limit=2,merge_with_series=False,partial_full_weighted="full")df33=df.Name.s_fuzz_all_values_in_column(limit=1,merge_with_series=True,partial_full_weighted="partial")df220Braund...70.833333477Cann,...63.8297871Angle,...55.445545518Astor,...53.0612242Sinkko...79.069767747Honkan...77.2727273Futrel...77.142857137Potter...52.8735634Gilles...84.615385722Saunde...77.7777785Bracke...77.777778221Scanla...76.4705886O'Brie...     65.116279          552    Maisne...     58.5365857Goodwi...68.852459386Palsso...67.8571438Rosblo...62.068966254Hockin...59.523819Nasser...74.074074122Astor,...58.536585fuzz_index_103717002216387941254686464737487749700Parameters:df:[pd.Series]limit:intHowmanyresultsdoyouwanttohave?Eachresultwillhave3columns[string,match,positionincolumn](default=5)partial_full_weighted:strweighted=fuzz.WRatiofull=fuzz.ratiopartial=fuzz.partial_ratio(default="weighted")merge_with_series:str(default=True)Returns:pd.DataFrameCompare values in column against list: pandas.Series.s_fuzz_from_list()froma_pandas_ex_fuzzimportpd_add_fuzzy_matchingpd_add_fuzzy_matching()#adds three new methods to pd.importpandasaspddf=pd.read_csv("https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/titanic.csv")df111=df.Name.s_fuzz_from_list(list_to_compare=["Johannes","Paulo","Kevin"],limit=2,merge_with_series=True,partial_full_weighted="partial",)df222=df.Name.s_fuzz_from_list(list_to_compare=["John","Johannes","Paulo","Kevin"],limit=3,merge_with_series=False,partial_full_weighted="full",)df333=df.Name.s_fuzz_from_list(list_to_compare=["Maria","Anna"],limit=1,merge_with_series=False,partial_full_weighted="partial",)df333fuzz_string_0fuzz_match_0fuzz_index_00Maria60.001Maria44.44444402Anna75.013Maria40.004Maria40.00...........886Maria40.00887Maria80.00888Maria60.00889Maria40.00890Maria60.00[891rowsx3columns]Parameters:df:[pd.Series]list_to_compare:listThestringsyouwanttobecomparedlimit:intHowmanyresultsdoyouwanttohave?Eachresultwillhave3columns[string,match,positionincolumn](default=5)partial_full_weighted:strweighted=fuzz.WRatiofull=fuzz.ratiopartial=fuzz.partial_ratio(default="weighted")merge_with_series:str(default=True)Returns:pd.DataFrameCompare values in column against list: pandas.Series.s_fuzz_one_word()froma_pandas_ex_fuzzimportpd_add_fuzzy_matchingpd_add_fuzzy_matching()#adds three new methods to pd.importpandasaspddf=pd.read_csv("https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/titanic.csv")df1=df.Name.s_fuzz_one_word(word_to_search="Karolina",partial_full_weighted="weighted")df2=df.Name.s_fuzz_one_word(word_to_search="Karolina",partial_full_weighted="full")df3=df.Name.s_fuzz_one_word(word_to_search="Karolina",partial_full_weighted="partial")df1Namefuzz_string_0\0Braund,Mr.OwenHarrisKarolina1Cumings,Mrs.JohnBradley(FlorenceBriggsThayer)Karolina2Heikkinen,Miss.LainaKarolina3Futrelle,Mrs.JacquesHeath(LilyMayPeel)Karolina4Allen,Mr.WilliamHenryKarolina5Moran,Mr.JamesKarolina6McCarthy,Mr.TimothyJKarolina7Palsson,Master.GostaLeonardKarolina8Johnson,Mrs.OscarW(ElisabethVilhelminaBerg)Karolina9Nasser,Mrs.Nicholas(AdeleAchem)Karolinafuzz_match_0041.538462133.750000260.000000333.750000442.750000530.000000627.692308745.000000845.600000942.750000df2Namefuzz_string_0\0Braund,Mr.OwenHarrisKarolina1Cumings,Mrs.JohnBradley(FlorenceBriggsThayer)Karolina2Heikkinen,Miss.LainaKarolina3Futrelle,Mrs.JacquesHeath(LilyMayPeel)Karolina4Allen,Mr.WilliamHenryKarolina5Moran,Mr.JamesKarolina6McCarthy,Mr.TimothyJKarolina7Palsson,Master.GostaLeonardKarolina8Johnson,Mrs.OscarW(ElisabethVilhelminaBerg)Karolina9Nasser,Mrs.Nicholas(AdeleAchem)Karolinafuzz_match_0032.258065117.241379233.333333315.686275431.250000525.000000619.354839731.578947821.428571923.809524df3Namefuzz_string_0\0Braund,Mr.OwenHarrisKarolina1Cumings,Mrs.JohnBradley(FlorenceBriggsThayer)Karolina2Heikkinen,Miss.LainaKarolina3Futrelle,Mrs.JacquesHeath(LilyMayPeel)Karolina4Allen,Mr.WilliamHenryKarolina5Moran,Mr.JamesKarolina6McCarthy,Mr.TimothyJKarolina7Palsson,Master.GostaLeonardKarolina8Johnson,Mrs.OscarW(ElisabethVilhelminaBerg)Karolina9Nasser,Mrs.Nicholas(AdeleAchem)Karolinafuzz_match_0046.153846137.500000266.666667337.500000446.153846533.333333630.769231750.000000850.000000940.000000Parameters:df:[pd.Series]word_to_search:strpartial_full_weighted:strweighted=fuzz.WRatiofull=fuzz.ratiopartial=fuzz.partial_ratio(default="weighted")Returns:pd.DataFramepandas.Series.ds_fuzz_compare_row_to_others/ pandas.DataFrame.ds_fuzz_compare_row_to_othersfroma_pandas_ex_fuzzimportpd_add_fuzzy_matchingpd_add_fuzzy_matching()importpandasaspddf=pd.read_csv("https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/titanic.csv")df.ds_fuzz_compare_row_to_others(2,loc_or_iloc='iloc',partial_full_weighted='full',sort_values=True)Out[4]:PassengerIdSurvivedPclass...CabinEmbarkedaa_fuzz_match2313...NaNS100.00000021621713...NaNS90.81632781681703...NaNS88.11881238238303...NaNS83.76963440040113...NaNS83.769634.......................74574601...B22S54.45026255655711...A16C53.74449358158211...C68C53.45622166967011...C126S52.13270130730811...C65C51.612903[891rowsx13columns]