python - Explanation needed: what does ~variable.MAKE.isnull() do? -
data = input_data[~input_data.make.isnull()]
i new python , have been learning basics week. working on data science projects using basic skills. have above line in python tutorial i'm going through , i'm not sure does. can me it?
the tilde '~'
"bitwise complement" operator; per the python wiki:
~ x
returns complement of
x
- number switching each1
0
, each0
1
. same-x - 1
.
input_data.make.isnull()
give rows contain nulls in make
, complement rows not, therefore:
data = input_data[~input_data.make.isnull()]
will index input_data
rows make
isn't null, i.e. drop of rows is null.
Comments
Post a Comment