-2

dataframe

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.

Sofía
  • 3
  • 1

1 Answers1

0
df.Met = np.where(~df.Met.isin(['Yes', 'No']), np.nan, df.Met)

Try this.

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