Loop Attributes Not Working for Attribute Name Containing Space

AustinTAustinT RapidMiner Certified Analyst, Member Posts: 12 Contributor II
edited January 16 in Help
Hi RM and Community - working in Studio 9.0.001 and trying to utilize Loop Attributes to convert several attributes from Nominal to Date. 

I experienced the error "Error evaluating expression: the function 'eval' failed to parse the subexpression 'Bus Unit'. Cause: extraneous input Unit expecting operator."

My process utilizes Loop Attributes over a subset. Inside the loop there is a "Generate Attributes" operator attempting to generate "%{loop_attribute}_new" via an expression to convert the string to a Date. I have selected a single attribute "Bus Unit" to identify the issue but my use case is to select several.

I have found when I loop an Attribute with a space in the name - "Bus Unit" in this case - the exception is thrown. When I choose a single attribute of either poly/nominal or real type and the name does NOT contain a space, the loop attributes works wonderfully as expected.

I think this is a bug - can I get some feedback/assistance? I will attempt to utilize the "rename by replacing" operator to see if this helps. However I wouldn't expect spaces in the Attribute name to be a nuisance to RM. 

Best Answer

Answers

  • mschmitzmschmitz Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 2,064  RM Data Scientist
    Hi,
    i think you need to use
    #{loop_attribute}_new
    but i am confusing myself here all the time as well. @David_A is the local expression parser ninja.

    BR,
    Martin
    - Head of Data Science Services at RapidMiner -
    Dortmund, Germany
  • jczogallajczogalla Employee, Member Posts: 123   RM Engineering
    Hi,
    I think Martin is half right. You can keep the %{loop_attribute}_new to create the name of the new attribute, but you can use #{loop_attribute} inside the expression to reference the macro as an attribute. But I think, I'd like David to conform it. :smile: 
    Cheers
    Jan
  • AustinTAustinT RapidMiner Certified Analyst, Member Posts: 12 Contributor II
    Hey gents, just wanted to update. I don't know why I can't crack the code on the names of attributes which RM likes. Also, the "#{loop_attribute}" syntax isn't correct unless I'm missing something obvious. 

    This error is so frustrating! Why would "Stnd_Hrs_Wk" not be a valid attribute name to include in a Loop Attributes??!

  • AustinTAustinT RapidMiner Certified Analyst, Member Posts: 12 Contributor II
    Oops - quick follow up: looks like my previous renaming efforts introduced a space next to the underscore so the actual attribute name is "Stnd_Hrs _Wk" so that's not a huge surprise. I'll go back with fiddling with the rename and loops. 
    jczogalla
  • Telcontar120Telcontar120 Moderator, RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 1,179   Unicorn
    Glad you found that because underscores should be fine inside loops, macros, and Generate Attributes.  I use them all the time.  But definitely not spaces  :)
    Brian T.
    Lindon Ventures 
    Data Science Consulting from Certified RapidMiner Experts
Sign In or Register to comment.