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
  • 3,276
  • 3
  • 21
  • 39

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
  • 48,973
  • 4
  • 21
  • 30