title: Getting Cannot mask with non-boolean array containing NA / NaN values... But there aren't any missing values
body: <p>I had this working, and now I changed &quot;something&quot; and it doesn't work any more. I have a table in Excel that I'm reading into a df. That works as expected. I read it in, and then I filter it so I only have the rows of data that match a specific criteria. Here's the code:</p>
  <pre class="lang-py prettyprint-override"><code>    df = excel_range_upper_left.options(pd.DataFrame, expand='table', header=1,
              index=False).value
  
      print(f'Check for missings')
      for c in df.columns:
          count = df[c].isnull().sum()
          print(f'Col {c} has {count} missing values')
      print(f'Done checking for missings')
  
      df = df[df[&quot;Phase&quot;].str.contains('2')]  #, na=False)]
  </code></pre>
  <p>The for loop cycles through the df columns looking for missing values. They all come back as 0 missing values.</p>
  <p>Then I execute the last statement, which should (I think) simply filter the df into a new df (of the same name) that has to have a string value '2' in the 'Phase' column. And that where it errors out with the <code>Cannot mask...</code> error.</p>
  <p>My guess is that there is still a missing value somewhere in the table, but I've exhausted my ability to find it (I also tried the following - but it results in the same thing as the original df and still errors out:</p>
  <pre class="lang-py prettyprint-override"><code>    print(f'{exer_df.dropna(axis=1)}')
  </code></pre>
  <p>If I change the filter line to the following so it includes the <code>na=False</code> option, everything works. But I don't know why...</p>
  <pre class="lang-py prettyprint-override"><code>exer_df = exer_df[exer_df[&quot;Phase&quot;].str.contains('2', na=False)]
  </code></pre>
  <p>Anyone have any insight and help?</p>
  <p>For completeness, here are the results from the for loop and then the error:</p>
  <pre><code>Check for missings
  Col Type as 0 missing values
  Col Sub-Type as 0 missing values
  Col Phase as 0 missing values
  Col Body Parts as 0 missing values
  Col Sets as 0 missing values
  Col Reps as 0 missing values
  Col Tempo as 0 missing values
  Col Intensity as 0 missing values
  Col Rest Period as 0 missing values
  Col Exercise as 0 missing values
  Col Prim Mover as 0 missing values
  Done checking for miossings
  Traceback (most recent call last):
    File &quot;c:/Users/kirby/OneDrive/Beating Old Age Book/Blog Page Text/nutrition/calculations/plan_creator.py&quot;, line 271, in &lt;module&gt;
      mcp()
    File &quot;c:/Users/kirby/OneDrive/Beating Old Age Book/Blog Page Text/nutrition/calculations/plan_creator.py&quot;, line 188, in mcp
      exer_df = exer_df[exer_df[&quot;Phase&quot;].str.contains('2')]  #, na=False)]
    File &quot;C:\Users\kirby\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\frame.py&quot;, line 3014, in __getitem__
      if com.is_bool_indexer(key):
    File &quot;C:\Users\kirby\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pandas\core\common.py&quot;, line 114, in is_bool_indexer
      raise ValueError(na_msg)
  ValueError: Cannot mask with non-boolean array containing NA / NaN values
  </code></pre>