I am working with the data frame shown in the link above. I want to make all rows that do not contain the words 'Yes' or 'No' be replaced with NaN.
Asked
Active
Viewed 523 times
1 Answers
0
df.Met = np.where(~df.Met.isin(['Yes', 'No']), np.nan, df.Met)
Try this.

Ashish Acharya
- 3,349
- 1
- 16
- 25