I have a dataframe like as shown below
df = pd.DataFrame({'person_id': [101,101,101,101],
'start_date':['NA-NA-NA NA:NA:NA','Nil','06/06/2014 08:00:00 AM','06/06/2014 05:00:00 AM'],
'desc':['-','- ',' - ','test-date'],
'type':['test-date','actual-version','depat-head','oxygen-parlor']})
I would like to replace the values NA-NA-NA NA:NA:NA, Nil, - with np.nan
I tried the below
df.replace(['NA-NA-NA NA:NA:NA','Nil','-', np.nan)
df.dropna(subset=['person_id','start_date','desc','type'], how='any')
Though the above works to an extent, it is not accurate because it doesn't consider hyphens with spaces - or - etc. Please note that the - in type column SHOULD NOT BE REPLACED.
Can help me replace exact values (but with exceptions of space characters) across dataframe but without using column names?
I expect my output to be like as shown below
person_id start_date desc type
101 06/06/2014 05:00:00 AM test-date oxygen-parlor