title: Pandas Python - TypeError: bad operand type for unary ~: 'float'
body: <p>I had put together the below code weeks ago and it was working as intended but now when I go back to run it i'm getting an error. </p>
  
  <pre><code>import pandas as pd
  import numpy as np
  file1 = "List - raw .csv"
  df = pd.read_csv(file1)
  pd.options.display.float_format = '{:,.2f}'.format 
  
  df.loc[~df['Ship To Customer Zip'].str.contains('[A-Za-z]'), 'ZipCleaned'] = df['Ship To Customer Zip'].str.slice(stop=5)
  </code></pre>
  
  <blockquote>
    <p>Error:
        Traceback (most recent call last):
          File "", line 1, in 
          File "C:\users...Python\Python37-32\lib\site-packages\pandas\core\generic.py", line 1541, in <strong>invert</strong>
            arr = operator.inv(com.values_from_object(self))
        TypeError: bad operand type for unary ~: 'float'</p>
  </blockquote>
  
  <p>The code was working as intended as of a few days ago.  I also have back up code which I checked and it's generating the same error. </p>