title: Segment/profiling in python
body: <p>Help please!!</p>
  
  <p>I was trying to create a column 'Segment' based on the condition:</p>
  
  <pre><code> if 'Pro_vol' &gt;1 and 'Cost' &gt;=43 then append 1 
   if 'Pro_vol' ==1 and 'Cost' &gt;=33 then append 1 
   or append 0
  </code></pre>
  
  <p>Below is the code for data:</p>
  
  <pre><code>df = pd.DataFrame({'ID':[1,2,3,4,5,6,7,8,9,10],
              'Pro_vol':[1,2,3,1,5,1,2,1,4,5],
                'Cost' : [12.34,13.55,34.00, 19.15,13.22,22.34,33.55,44.00, 29.15,53.22]})
  </code></pre>
  
  <p>I tried a code:</p>
  
  <pre><code>Segment=[]
  
  for i in df['Pro_vol']:
  if i &gt;1:
      Segment.append(1)
      for j in df['Cost']:
          if j&gt;=43:
              Segment.append(1)
  elif i==1:
      Segment.append(1)
  elif j&gt;=33:
      Segment.append(1)
  else:
      Segment.append(0)
  
  df['Segment']=Segment
  </code></pre>
  
  <p>And it was giving me an error:</p>
  
  <pre><code>ValueError: Length of values does not match length of index
  </code></pre>
  
  <p>I don't know any other way to try to find an answer!!</p>