Carlos Arronte Bello
Carlos Arronte Bello

Reputation: 429

Change value in specific row in pandas

I need some help in python. I need to modify the value in a specific row. I have something like this.

ID      Status      Customer Name 
345      New         Braskem S.A
923     Closed       Braskem 
046      New         Braskem S.A
195      New         Braskem S.A
537     In Progress  Braskem 
237     On Hold      Vale
355     Closed       BIMBO

Here i need to change all the customer name "Braskem S.A" to "Braskem" Can someone give me a hand with this please? Thanks I will appreciate the help and sorry for bad English.

Upvotes: 0

Views: 373

Answers (1)

Aleksey Bilogur
Aleksey Bilogur

Reputation: 3846

There's a few ways to do this. Arguably the simplest is to use pandas.DataFrame.replace:

df.replace(to_replace='Braskem S.A', value='Braskem')

You can also use a boolean mask or a map.

Upvotes: 2

Related Questions