Replace values by conditional match
dedeer
New Altair Community Member
Hi all,
I searched the community and couldn't find the answer. Maybe it was solved before but I need it urgently. So appreciate if you answer again.
I am working on a very messy dataset. As you look above, models L200, L 200, MITSUBISHI L200 etc. (I mean all of them) are the same model of a brand. I would like to replace any value that has "200" with "L200".
ex value - --------------------- -new value
MITSUBISHI L 200 -L200
L 200 -L200
L200 4x4 -L200
so on.
is there any easy way of doing it?
I searched the community and couldn't find the answer. Maybe it was solved before but I need it urgently. So appreciate if you answer again.
I am working on a very messy dataset. As you look above, models L200, L 200, MITSUBISHI L200 etc. (I mean all of them) are the same model of a brand. I would like to replace any value that has "200" with "L200".
ex value - --------------------- -new value
MITSUBISHI L 200 -L200
L 200 -L200
L200 4x4 -L200
so on.
is there any easy way of doing it?
0
Best Answer
-
Hey @dedeer ,
You can use Generate attributes to create a cleaned attribute as following. If it just few cases that you want to clean.if(contains(model,"200"),"L200",model)
Also, you can explore regex with Replace operator for a more generalized solution.
2
Answers
-
Hey @dedeer ,
You can use Generate attributes to create a cleaned attribute as following. If it just few cases that you want to clean.if(contains(model,"200"),"L200",model)
Also, you can explore regex with Replace operator for a more generalized solution.
2