0

I am a beginner to Python and pandas ,I need to filter rows when a given columns/column in the list is spaces or Nulls or Nan

enter image description here

My result should be like this

enter image description here

Rejection rows:-

enter image description here

I am storing the keys in a list for this data frame in cols_list.

cols_list = ['Product_ID','Vendor_ID']

To remove Nans:

df2 = df.dropna(axis = 0, subset = cols_list, how = 'all', inplace = True) 

but I would like to remove rows if both keys have spaces or either one has spaces too. also i would like to capture the dropped rows in to another data frame .

df2 = df[df[cols_list].isna()]

Can any one please advise to check for spaces as well as Nan and remove those rows and capture the same . Since isna is not getting any of rows.Please advise and help.

0 Answers0