title: How do I compare two columns in Pandas Dataframe to find the match percentages and return a value based on that logic?
body: <p><strong>I need to compare two columns in a Pandas data frame and fuzzy match.</strong></p>
  <p>If the fuzzy match is above a certain percentage (e.g. 85), I need to return that percentage, or a string saying <code>&quot;Partial Match&quot;</code></p>
  <p>If it matches fully, return <code>&quot;Full Match&quot;</code></p>
  <p>If it doesn't match, return <code>&quot;No Match&quot;</code></p>
  <p><strong>Solutions I've tried:</strong></p>
  <p><strong>Attempt #1</strong></p>
  <pre><code> conditions = [
       (df['one'] == df['two']),fuzz.ratio((df['one'],df['two'])) &gt; 80, 
        fuzz.ratio((df['one'],df['two'])) &lt;= 80]
  
    choices = [&quot;FULL Match&quot;, fuzz.ratio((df['one'],df['two'])),&quot;NO MATCH&quot;]
  </code></pre>
  <blockquote>
  <p>df['result'] = np.select(condition,choices, default = np.nan)</p>
  </blockquote>
  <p>====================================================================</p>
  <p><strong>Attempt #2</strong></p>
  <blockquote>
  <p>df['result'] = np.where(fuzz.ratio(df['one'], df['two']) &gt;= 85, &quot;Partial Match&quot;, 'No Match')</p>
  </blockquote>
  <pre><code> import pandas as pd
   import numpy as np
   from fuzzywuzzy import fuzz
   import os
  
  
   df = pd.read_csv('data.csv')
  
   &gt;x = fuzz.ratio(df['one'], df['two']) &gt;= 85
  
   df['result'] = np.where(x, &quot;Match&quot;, 'No Match')'''
  </code></pre>
  <p><strong>Expected Result</strong></p>
  <pre><code>         one          two    result
   0    apple        Apple     Partial Match
   1  banana       bannana     Partial Match
   2     kiwi  dragonfruit     No Match
   3    mango        mango     Full Match
  </code></pre>
  <p>===================================================================</p>
  <p><strong>Error Message:</strong></p>
  <p><strong>Attempt #1</strong></p>
  <p>IndexError: tuple index out of range</p>
  <p><strong>Attempt #2</strong></p>
  <p>ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().</p>