0

I have a dataframe where I would like to find a specific value in a row and column and replace it with a blank. I would like to replace the value in the ['type'] column in the row that contains 'CC'

Data

ID date      type
AA 1/1/2022  Ok
BB 2/1/2022  Hi
CC 2/1/2022  Hi

Desired

ID date      type
AA 1/1/2022  Ok
BB 2/1/2022  Hi
CC 2/1/2022  

Doing

df['type'] = df['type'].str.replace('Hi','')

However this is removing all values in the column. Any suggestion is appreciated.

Lynn
  • 4,292
  • 5
  • 21
  • 44

0 Answers0