Edit: Figured it out. Thanks.
I think I must have missed something in my studies and I'm hoping you can help explain. I'm working on a case study and the following line is used to subset the semi-cleaned df to remove the values in the nonBoroughs list from the column London_Boroughs.
NaNFreeDF2[~NaNFreeDF2.London_Borough.isin(nonBoroughs)]
The two things I'm not understanding are:
Why is it '~' instead of '!' for the not operator? or is '~' an entirely different operator in pandas?
Why is the above code used instead of
NaNFreeDF2[NaNFreeDF2['London_Borough'] != nonBoroughs]]? Is the above just a more advanced way of doing it that I haven't learned yet?
Thanks in advance!