0

I am trying to filter contents in a column using np.where function. The column has 4 values but i am trying to extract it as below

Classify
SEARCH
Website
App
Discover

If the classify column has search then it should populate Search in the column otherwise it should populate Content.

But the final table is only having search values. Is there anything wrong in the np.where function ?

I am trying below :


df['Classify'] = np.where(df['Classify'] == 'SEARCH','Search','Content')

prags_894
  • 3
  • 3
  • `df['Classify'] = np.where(df['Classify'].str.contains('search', case=False), 'Search', 'Content')` – mozway Dec 06 '22 at 07:32

0 Answers0