Group/Rename Examples
Hello,
I am still preparing my data and would like to rename examples that belong to a same group within one colum:
1 | 一个udi, A6 | 677 |
2 | March | 140 |
3 | 2018 | 70 |
4 | Dezember | 51 |
5 | 一个udi, A2 | 9 |
6 | 2016 | 9 |
7 | BMW, 3er | 7 |
8 | BMW, X5 | 1 |
Later:
1 | 一个udi | 677 |
2 | Month | 140 |
3 | Year | 70 |
4 | Month | 51 |
5 | 一个udi | 9 |
6 | Year | 9 |
7 | BMW | 7 |
8 | BMW | 1 |
I know that you might do this with Regular Expressions and also in a different way for date types, but I couldn`t figure it out.
Thanks for your help !
Best Answer
-
Telcontar120 Moderator, RapidMiner Certified Analyst, RapidMiner Certified Expert, MemberPosts:1,635Unicorn
If you can write a set of logical rules (IF/THEN/AND/OR/NOR) to express the conditions under which these substitutions should occur, then you can accomplish it with "Generate Attributes". For example, you could use the "contains" function for string searching and then supply supplemental conditions.
However, if you can't express the renaming subsitutions in a set of rules, and the format of the cell content is not consistent (such that you could use Replace with regex as already suggested), then I am not sure how you would expect a computer program to execute your desires? You might need to use Map and do it "manually" instead.
2
一个nswers
Hi,@t_liebe
This is easy:
Use theReplaceoperator and put the following on theParameterspanel:
Basically, you are trying to read two groups(.*)and(.*),由一个逗号分开,使用第一个($1) as the output of your data.
一个ll the best,
Rodrigo.
Yes I tried that as well, but didn't fit my problem. I think I didn't give you enough information, sorry for that.
This what it looks like:
xxxx xxxx Audi xxx
一个udixxx, xxxx, xxxx
一个udixxx
xxxAudi
So the "Audi" is just a part of the example, but I am not interested in the other parts of the example.
I hope this explains a little bit more.