Replace a string in a list with one string

PHOTO EMBED

Fri Feb 04 2022 03:41:48 GMT+0000 (Coordinated Universal Time)

Saved by @Milados

df['Class'] = np.where(df['Class'].isin(['Individual','Group']), df['Class'], 'Other')
content_copyCOPY

https://stackoverflow.com/questions/51323038/pandas-replace-a-string-with-other-if-it-is-not-present-in-a-list-of-strings