Hi all! How can I replace words?
GeorgeOik1999
New Altair Community Member
It is not practical to Map one by one all the values , so I want to replace the words with numbers. When I see TV Horror I want to be 15 all the example and TV Dramas=4. Is there any faster way ( some regular expresion ) that will replace the whole example?
Tagged:
0
Comments
-
Hi @GeorgeOik1999,have you try with the replace function of Generate Attribute?, something like this may be usefulreplace(text, "TV Horror", "15")
Best,
Cesar1 -
If you use the suggested solution by @ceaperez you might be better of using the replace with dictionary operator, as this may spare some room on your screen if you have lots of labels. But in the end you don't fix your problem I think, all you have will be that your text is replaced with a number, so the mapping issue will remain.
Another option might be to combine a couple of things, you could use the split operator on your [listed_in] field, and split on , (comma space). next you could loop through all your attributes, filter out all empty ones and you'll be left with a nice list of single entries
So TV Horror, Teen TV shows will first become
Att1 Att2
TV Horror Teen TV Shows
and then
TV Horror
Teen TV shows
...
5