str.contains if the null value

df1 = df [(df.tag! = 39) & (df.company.str.contains ( 'pot', na = False))]

 

na = False if you encounter is empty, so that it is equal to False

Guess you like

Origin www.cnblogs.com/yjybupt/p/11497901.html