check if value is null python code example
Example 1: python - check for null values
df.isnull().sum()
Example 2: python if not null
#variable
var = "hello python"
#check is not null
if var is not NaN:
print('Var is not null')
Example 3: python null ==
if foo is None:
...
Example 4: python if column is null then
df['real_lastName'] = np.where(df['LastName'].isnull(), df['Middle'], df['LastName'] )
print (df)
FirstName Middle LastName real_lastName
0 Tom Ju NaN Ju
1 Kity NaN Rob Rob