Add up a group_index for each ID in Dataset
Learner III
Given following example set:
id;group_index
1
1
1
1
1
2
2
2
2
2
3
3
3
3
3
3
and i want the group index to be filled like:
id;group_index
1;1
1;2
1;3
1;4
1;5
2;1
2;2
2;3
2;4
3;1
3;2
3;3
3;4
How an i manage this? i tried loop values in combination with generate attributes but it's setting 1 for each ID or count up in one row.
Thank you!
Answers
-
MartinLiebig Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,533
RM Data Scientist
Hi,
Group Into Collection + Loop Collection with Generate ID inside is at least one way of doing it.
BR,
Martin
- Sr. Director Data Solutions, Altair RapidMiner -
Dortmund, Germany0 -
BalazsBarany Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert Posts: 955
Unicorn
Hi,
you could check out this project:
https://github.com/bbarany/rapidminer-windowfunctions
Your request is an application of window functions, available in relational databases. The project mentioned there implements these in RapidMiner. You can use this process, group by the id and use the row_number() function to get exactly the result you want.
Regards,
Balázs
0 -
yyhuang Administrator, Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 364
RM Data Scientist