title: if cell in column is null using Pandas
body: <p>I want to set a variable to 0 if the "Independent" column is equal to 0,1,or null. I have been trying something like this:</p>
  
  <pre><code>        df["Iflag"] = df.Independent.where((df.Independent == 0) | (df.Independent == 1 )|(df.Independent.isnull())).astype(int)
              Iflag = df[df.Iflag == 0]
              pd.DataFrame(Iflag, columns=["LocIdent","Independent"]).to_csv(Targcsv, mode='ab')
  </code></pre>
  
  <p>I get an error that says I cannot convert NA to integer. This code works when I drop the check to see if Independent is null. My question is, what is the best way to write an if statement that includes null values in Pandas?</p>