title: Is there a way to return float or integer from a conditional True/False
body: <pre><code>n_level = range(1, steps + 2)
  </code></pre>
  <p><code>steps</code> is user input, using multi-index dataframe</p>
  <pre><code>    df = {'crest': [754, 755, 762, 785], 'trough': [752, 725, 759, 765], 'L1T': [761, 761, 761, 761], 'L2T': [772, 772, 772, 772], 'L3T': [783, 783, 783, 783], 'L4T': [794, 794, 794, 794], 'L1M': [740, 740, 740, 740], 'L2M': [729, 729, 729, 729], 'L3M': [718, 718, 718, 718], 'L4T': [707, 707, 707, 707]}
  
  
      for i in n_level:
          if df['Crest'] &gt;= df[f'L{i}T']:
              df['Marker'] = i
          elif df['Trough'] &lt;= df[f'L{i}M']:
              df['Marker'] = -i
          else:
              df['Marker'] = 0
  </code></pre>
  <p>I am expecting below df with the col marker</p>
  <pre><code>    df = {'crest': [754, 755, 762, 785], 'trough': [752, 725, 759, 765], 'L1T': [761, 761, 761, 761], 'L2T': [772, 772, 772, 772], 'L3T': [783, 783, 783, 783], 'L4T': [794, 794, 794, 794], 'L1M': [740, 740, 740, 740], 'L2M': [729, 729, 729, 729], 'L3M': [718, 718, 718, 718], 'L4T': [707, 707, 707, 707], 'Marker': [0, -2, 1, 3]}, 
  </code></pre>
  <p>The if statement is returning True or False, using that can we convert it to the ith Value (+/-)</p>
  <p>what I need is another col df['Marker'], which will measure if the crest or trough crossed L{i}T or L{i}M, any breach on the upside in case of the crest and breach on the downside in case of the trough</p>
  <p><a href="https://i.stack.imgur.com/0YRDZ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/0YRDZ.png" alt="Sample Dataframe" /></a></p>