This is the piece of code where I assigned np.nan:
df['column1'] = pd.np.where(df5.column5.str.contains("ABC"), "GHI",
pd.np.where(df5.column5.str.contains("DEF"), "KLM", np.nan))
And I want to filter out rows where 'column1' is NaN. I tried using isnull() and isna() but these didn't work. What worked here is the below:
df = df [df['column1'] != 'nan']
Which means np.nan is stored as string. Why is this happening? And how can I fix this?