title: save Pandas dataframe values in a dictionary given criteria
body: <p>I have a <code>pandas df</code> that contains numbers of visitors and the paths they chose before completing the conversion goal. Each row represents the path and the numbers of visitors chose the path, for example, row1: 18 visitors visited '(entrance)' --> '/' --> '/ContactUS'/Default.aspx' before reaching the target goal</p>
  
  <p>I'm only interested in the product page that a visitor was at last and I'm trying to create a dictionary that takes product name, such as 'VFB25AEH' as the key and # of visits as the value</p>
  
  <pre><code>Step1                        Step2                  Step3              Visits 
  /ContactUs/Default.aspx        /                    (entrance)          18    
  /Products/GBR100L.aspx  /Products/VFB25AEH.aspx   /Products/RAD80L.aspx  9    
  /Products/VFB25AEH.aspx  (entrance)                 (not set)            5    
  /Products/RAD80L.aspx    (entrance)                 (not set)            4
  </code></pre>
  
  <p>The following is my code that loops through each column of each row, and save the first product page (step that contains '/Products/') and save the total number of visits in a dictionary</p>
  
  <pre><code>result = {}
  for i, row in enumerate(df.values):
      for c in row:
          if 'products' in str(c).lower():
              c = c.strip('.aspx').split('/')[2]
              if c in result:
                  result[c]+= 1
              result[c] = 1
  </code></pre>
  
  <p>Ideal result is - result['VFB25AEH'] = 5, result['RAD80L'] = 4, result['GBR100L']=9</p>
  
  <p>but, it turns out that the values in result were all '1'. Can someone help point out the error here??</p>