title: DataFrame filtering
body: <p>Given a DataFrame <code>df</code>, if one wanted to filter the DataFrame to rows that have <code>column_4</code> between 45 and 48, one might try the following code snippet:</p>
  <pre><code>import pandas as pd
  
  df = pd.DataFrame({f'column_{i}': range(i*10, 10*i+10) for i in range(10)})
  
  df2 = df[45 &lt; df['column_4'] &lt; 48]
  </code></pre>
  <p>However, this code yields a ValueError, because <code>The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().</code> One instead must do</p>
  <pre><code>import pandas as pd
  
  df = pd.DataFrame({f'column_{i}': range(i*10, 10*i+10) for i in range(10)})
  
  df2 = df[(45 &lt; df['column_4']) &amp; (df['column_4'] &lt; 48)]
  </code></pre>
  <p>Why is this the case - and is this a hacky way to filter a DataFrame?</p>
  <p>This question has a seemingly partial answer <a href="https://stackoverflow.com/questions/36921951/truth-value-of-a-series-is-ambiguous-use-a-empty-a-bool-a-item-a-any-o">here</a>, however that does not seem to address specifically why <code>45 &lt; a &lt; 48</code> does not work.</p>