Replace values by conditional match

dedeer
dedeer New Altair Community Member
edited November 2024 in Community Q&A
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? 

Best Answer

  • hbajpai
    hbajpai New Altair Community Member
    edited April 2020 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.


Answers

  • hbajpai
    hbajpai New Altair Community Member
    edited April 2020 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.


Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.