title: Operation on Regex identified digits in python data frame
body: <h2>I have one data frame with 2 columns 3rd column is output format given below:</h2>
  
  <p>DF:</p>
  
  <blockquote>
  <pre><code>       reg     value   o/p**
      2 for $20    11     20/2
      4 for $24    12     24/4
      2 for $30    13     30/2
   Get $10 Cash    14     14
      3 for $30    21     30/3
  </code></pre>
    
    <p>First, I have to match [\d]+ for [$][\d]+ in reg column and then have
    to update the value column as 2nd integer of reg divide by the first
    integer of reg if no match keeps same value.</p>
  </blockquote>
  
  <p>My code is:</p>
  
  <pre><code>df["value"]=df["reg"].map(lambda x: (int(re.findall("[\d]+",x)[1]))/int(re.findall("[\d]+",x)[0]) if(re.search(r"[\d]+ for [$][\d]+" , x)) else x)
  </code></pre>
  
  <blockquote>
    <p>The code output is correct for match cases only.</p>
  </blockquote>