<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Field calculator Python function using Fuzzy string in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/field-calculator-python-function-using-fuzzy/m-p/705720#M54606</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to -simply- compare the values from three columns using Fuzzywuzzy python library and return the percentage value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to do something like this, but of course, this function is not working!&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/343706_SetMatch.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;How I can make this one work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;from fuzzywuzzy import fuzz&lt;BR /&gt;from fuzzywuzzy import process&lt;BR /&gt; def function(query,v1,v2,v3) &lt;BR /&gt; choices = [v1,v2,v3 ]&lt;BR /&gt; result= process.extractOne(query, choices)&lt;BR /&gt; return result&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can make Fuzzy work for comparing&amp;nbsp;only two columns like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Pre-logic script code:&lt;BR /&gt;from fuzzywuzzy import fuzz&lt;BR /&gt;from fuzzywuzzy import process&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--------------------------------------------&lt;/P&gt;&lt;P&gt;fuzz.ratio(!column1!, !column2!)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;this link can give you an idea about &amp;nbsp;Fuzzy string:&lt;A class="link-titled" href="https://marcobonzanini.com/2015/02/25/fuzzy-string-matching-in-python/" title="https://marcobonzanini.com/2015/02/25/fuzzy-string-matching-in-python/"&gt; Fuzzy String Matching in Python – Marco Bonzanini&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will really appreciate&amp;nbsp;your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Mar 2017 16:10:23 GMT</pubDate>
    <dc:creator>AhmedAbdelnasser1</dc:creator>
    <dc:date>2017-03-23T16:10:23Z</dc:date>
    <item>
      <title>Field calculator Python function using Fuzzy string</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-python-function-using-fuzzy/m-p/705720#M54606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to -simply- compare the values from three columns using Fuzzywuzzy python library and return the percentage value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to do something like this, but of course, this function is not working!&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/343706_SetMatch.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;How I can make this one work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;from fuzzywuzzy import fuzz&lt;BR /&gt;from fuzzywuzzy import process&lt;BR /&gt; def function(query,v1,v2,v3) &lt;BR /&gt; choices = [v1,v2,v3 ]&lt;BR /&gt; result= process.extractOne(query, choices)&lt;BR /&gt; return result&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can make Fuzzy work for comparing&amp;nbsp;only two columns like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Pre-logic script code:&lt;BR /&gt;from fuzzywuzzy import fuzz&lt;BR /&gt;from fuzzywuzzy import process&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--------------------------------------------&lt;/P&gt;&lt;P&gt;fuzz.ratio(!column1!, !column2!)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;this link can give you an idea about &amp;nbsp;Fuzzy string:&lt;A class="link-titled" href="https://marcobonzanini.com/2015/02/25/fuzzy-string-matching-in-python/" title="https://marcobonzanini.com/2015/02/25/fuzzy-string-matching-in-python/"&gt; Fuzzy String Matching in Python – Marco Bonzanini&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will really appreciate&amp;nbsp;your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Mar 2017 16:10:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-python-function-using-fuzzy/m-p/705720#M54606</guid>
      <dc:creator>AhmedAbdelnasser1</dc:creator>
      <dc:date>2017-03-23T16:10:23Z</dc:date>
    </item>
    <item>
      <title>Re: Field calculator Python function using Fuzzy string</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-python-function-using-fuzzy/m-p/705721#M54607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't have time to look at fuzzy string part, but there are some other issues I see.&amp;nbsp; First, you don't have a colon after your function definition:&amp;nbsp; &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;def functioname:&lt;/SPAN&gt; .&amp;nbsp; Second, your not doing any indentation with your function definition.&amp;nbsp; Third, you are passing 4 columns to the function, but the function only has 3 parameters.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Mar 2017 16:48:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-python-function-using-fuzzy/m-p/705721#M54607</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2017-03-23T16:48:28Z</dc:date>
    </item>
    <item>
      <title>Re: Field calculator Python function using Fuzzy string</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-python-function-using-fuzzy/m-p/705722#M54608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In your code, you are using &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;extractOne&lt;/SPAN&gt;, which returns a tuple with the highest-ranking string and its score.&amp;nbsp; What do you want to store in the &lt;SPAN style="font-family: courier new,courier,monospace;"&gt;FUZZY_STRING&lt;/SPAN&gt; field?&amp;nbsp; A string, a number, both?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Mar 2017 17:00:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-python-function-using-fuzzy/m-p/705722#M54608</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2017-03-23T17:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: Field calculator Python function using Fuzzy string</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-python-function-using-fuzzy/m-p/705723#M54609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I notice that some of your columns vary in case... ie !Column1! then !column2!&amp;nbsp; did you type those in or select them from the list of available columns&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Mar 2017 17:27:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-python-function-using-fuzzy/m-p/705723#M54609</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-03-23T17:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: Field calculator Python function using Fuzzy string</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-python-function-using-fuzzy/m-p/705724#M54610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dan -- field names are absolutely case-insensitive in Calculate Field expressions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Mar 2017 04:09:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-python-function-using-fuzzy/m-p/705724#M54610</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2017-03-24T04:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: Field calculator Python function using Fuzzy string</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-python-function-using-fuzzy/m-p/705725#M54611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ahhh.. too much python... and that&amp;nbsp;must be&amp;nbsp;jUsT a sTUpid vb legacy thing&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Mar 2017 05:08:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-python-function-using-fuzzy/m-p/705725#M54611</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-03-24T05:08:42Z</dc:date>
    </item>
    <item>
      <title>Re: Field calculator Python function using Fuzzy string</title>
      <link>https://community.esri.com/t5/python-questions/field-calculator-python-function-using-fuzzy/m-p/705726#M54612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Joshua&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I update the code to this and it worked for me&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;from fuzzywuzzy import fuzz&lt;BR /&gt;from fuzzywuzzy import process&lt;BR /&gt;def SetMatchPercenage(query,v1,v2,v3,v4):&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;choices = [v1,v2,v3,v4]&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;result=str(process.extractOne(query, choices))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return result&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 25 Mar 2017 19:53:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-calculator-python-function-using-fuzzy/m-p/705726#M54612</guid>
      <dc:creator>AhmedAbdelnasser1</dc:creator>
      <dc:date>2017-03-25T19:53:45Z</dc:date>
    </item>
  </channel>
</rss>

