In the given code it displays only the rows without NaN values but i want only the rows with NaN values in a provided column everything has to be removed
df1 = df1[pd.notnull(df1['column_name'])]
Data Science Stack Exchange is a question and answer site for Data science professionals, Machine Learning specialists, and those interested in learning more about the field. It only takes a minute to sign up.
Sign up to join this communityIf I am correct, you are looking to keep only the NaN values. You can use pd.isnull()
to check which rows are NaN and then only keep those. Try this:
df1 = df1[pd.isnull(df1['column_name'])]