0
pd_selftest = pd_selftest[pd_selftest['SICCD'] != 0]

pd_selftest = pd_selftest[~pd_selftest['SICCD'].isnull()]

I'd like to know what the function of the ~ is in the above code.

hrokr
  • 2,839
  • 3
  • 18
  • 35

1 Answers1

1

That's the bit-wise invert or not operator. So, it returns only those lines where the SICCID column is not null. I would probably use the word not in this case.

Tim Roberts
  • 34,376
  • 3
  • 17
  • 24