The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
Rows to Column
Hi,
I believe this is something basic but I haven't found the answer in the forums. Some similar things, but they haven't worked for me. I am trying to convert some rows into attributes. I have som data that looks like this:
Name 1
attr1
attr2
attr3
Name 2
attr1
attr2
attr3
All in the same column. I want to transpose or pivot into this:
Name 1 attr1 attr2 attr3
Name 2 attr1 attr2 attr3
I've been trying for hours. Please help. Thanks.
0
Answers
Hi @MSR,
Can you share your real dataset ?
Regards,
Lionel
Is this what you need?
Thanks
Hi again @MSR,
Can you share your data, a priori in your case, the files Data1.csv and Data2.csv ?
Regards,
Lionel
Hi,
I modified the program and files for privacy. Here's the new code:
@MSR,
It's far-fetched but it works :
loo
To execute this process you have to :
- Install the Value Series extension from the MarketPlace.
- Adapt the process according to the name of your "attributes" (they were "?" in the datas you provided).
The process :
I hope it helps,
Regards,
Lionel
I think there is an easier solution here, although as is so often the case with RapidMiner, there are probably multiple ways to do this.
Basically what you want to do is to De-Pivot the data, but your current structure lacks an index value. So we just create an index value using some MOD arithmetic to make sure that the appropriate groups get created based on the number of rows that need to be grouped together.
Here is a process that will do that same thing--you will simply need to drop the first subprocess (which simply creates an appropriate dataset) and swap it for your Read CSV, and then number of rows for the index calculation in the Generate Attributes (and remember that java counting begins with zero).
Lindon Ventures
Data Science Consulting from Certified RapidMiner Experts