title: TypeError: Cannot perform 'ror_' with a dtyped [float64] array and scalar of type [bool]
body: <p>I want to iterate through the column <code>df['fyear']</code> and delete any row for which <code>fyear</code> isn't equal to either 2009, 2019, or 2020. But this error comes up:</p>
  <p><code>TypeError: Cannot perform 'ror_' with a dtyped [float64] array and scalar of type [bool]</code></p>
  <pre><code>df = pd.DataFrame({'fyear': [2009, 2019, 2020, 2020, 2019, 2009, 2000, 2000, 2001]})
  
  for row in df.iterrows():
      if df[&quot;fyear&quot;] != 2009 | df[&quot;fyear&quot;] !=2019 | df[&quot;fyear&quot;] !=2020:
          df.drop(row)
  </code></pre>
  <p><strong>EDIT</strong> The optimal solution is using boolean indexing with either the operators <code>&amp;</code> or <code>|</code></p>
  <pre><code>df = df[(df['fyear'] == 2009) | (df['fyear'] == 2019) | (df['fyear'] == 2020)]
  </code></pre>