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
Data Cleansing Tips: How to Rename Attributes to Lower Case
MartinLiebig
Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,533 RM Data Scientist
The Rename and Rename by Replacing Operators are powerful tools if you want to rename your attributes. At some point, however, not even these tools are enough. One example for this is to transform all attributes into lower case characters. You need this for some databases or hdfs. The solution for this is a very short groovy script which loops over all attributes and replaces them with the lower case version.
ExampleSet inputData = input[0];
for(Attribute a : inputData.getAttributes()){
a.setName(a.getName().toLowerCase())
}
return inputData;
If you are working on hdfs you might also want to replace white spaces with under scores. This can be done by adding a small .replace to the script.
ExampleSet inputData = input[0];
for(Attribute a : inputData.getAttributes()){
a.setName(a.getName().toLowerCase().replace(" ","_"))
}
return inputData;
Attached is also a process demonstrating this on the Titanic data set.
- Sr. Director Data Solutions, Altair RapidMiner -
Dortmund, Germany
Dortmund, Germany
1
Comments
@mschmitz thanks for that clever workaround! But it seems like this would be some nice built-in functionality to add to RapidMiner. Always a pity to have to resort to groovy scripts for simple data ETL tasks like this one. Maybe a feature request for the future? Sounds like a mashup between the "transform cases" and the "rename" operators :smileyhappy:
Lindon Ventures
Data Science Consulting from Certified RapidMiner Experts
Hi @Telcontar120,
most likely the real functionallity would be an expression editor similar to Generate Attributes but for Attribute Names. That's not a trivial operator like this script.
@sgenzer, thoughts?
Dortmund, Germany
I agree with @Telcontar120 - seems like an Operator Toolbox operator to me
Scott
I agree, but not just a toolbox operator. I'd love to be able to do this with RegEx.
https://www.regular-expressions.info/replacecase.html