title: How do I get this for loop to return the dataframe broken up based on the ranges?
body: <p>I'm trying to write a program that will sort a dataframe based on a given range and return a subsets of the original dataframe. The range can be variable for the example I just 3. And the issue I'm having is when I try to split up dataframe the first range is the only one that is printed.</p>
  
  <p>I have tried &amp; statement, I am currently using .between, I have tried to add if statements and break and continue but none have achieved what I am after .between has come closest</p>
  
  <pre><code>data = { 'a':[3.0, 5.0, 7.0, 2.0], 'b':[1, 3, 5, 3], 'c':[2, 4, 6, 8]}
  range = [(0,2), (3,5), (6,8)]
  
  def sort_a(range, data):
      for item in (range):
          low, high = item
          data = data[data['a'].between(low, high)]
          print(data)
  </code></pre>
  
  <p>Expected</p>
  
  <pre><code>   a    b   c  
  0  2.0  3   8
  
  
     a    b   c
  0  3.0  1   2
  1  5.0  3   4
  
     a    b   c
  0  7.0  5   6
  </code></pre>
  
  <p>Actual</p>
  
  <pre><code>   a    b   c  
  0  2.0  3   8
  Empty DataFrame
  Columns: [a, b, c]
  Index: []
  Empty DataFrame
  Columns: [a, b, c]
  Index: []
  </code></pre>