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
Can we add support for negative units on cut() and probably others?
rfuentealba
RapidMiner Certified Analyst, Member, University Professor Posts: 568 Unicorn
in Help
Well, today I had an interesting, super simple case. I had the following strings:
Enero 2016
Febrero 2016
Marzo 2016
Abril 2016
...
Those are strings that define "periods" (months, as "enero" is January, etc...) but not exactly dates (as this is the name of the period for an invoice, and therefore it's treated like a categorical variable, but the actual reading date for January 2016 could be 30 December 2015 and the emission date could be 2 February 2016, so there is no need to use a date expression to define it).
I wanted to obtain just the portion of the string that says "2016" at the end with the "Generate Attributes" operator (there is plenty of ways to do that, but I kinda like to use some programming to generate a new attribute). To my dismay, the syntax for cut does not allow negative numbers, so I couldn't do the following:
cut("Periodo", 0, -4)
I think this is very specific, might not be relevant, and it can make the bottom of the priority list of features but... IDK, can this be added? it's just that I'm used to have these things in other programming languages, I thought it can just be a nice thing to have.
All the best,
Rod.
Tagged:
2
Best Answers
-
MartinLiebig Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert, University Professor Posts: 3,533 RM Data ScientistHi @rfuentealba,
why cant you just use suffix("Periodo",4)? This would give you the right result.
Sure you may want to do:
cut("att",-10,-4)
at some point. Which needs clever combination of prefix and suffix, but would work.
Best,
Martin- Sr. Director Data Solutions, Altair RapidMiner -
Dortmund, Germany6 -
sgenzer Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM Moderator Posts: 2,959 Community ManagerI usually do "suffix(Periodo,length(Periodo)-index(Periodo," ")-1)" or similar. You can add a parse if you want it to be numerical.
6
Answers