Skip to content
Advertisement

replace multiple string values with different values in a column (python)

Here is a sample dataset:

ID Description
1 he wants some epples
2 she bought 2kgs of bakana
3 he got nothing
4 she took potato and tomat

I wanted to replace it this way:

JavaScript

It returned error:

TypeError: replace() missing 1 required positional argument: ‘repl’

What can I do to reach this result:

ID Description
1 he wants some apples
2 she bought 2kgs of banana
3 he got nothing
4 she took potato and tomato

Advertisement

Answer

Try like this :

JavaScript

Output :

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement