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?

rfuentealbarfuentealba RapidMiner Certified Analyst, Member, University Professor Posts: 568 Unicorn
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:

Best Answers

Answers

  • BalazsBaranyBalazsBarany Administrator, Moderator, Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert Posts: 955 Unicorn
    The negative offset syntax is quite common in other expression languages to refer to "count from the end". I like this idea very much.
  • rfuentealbarfuentealba RapidMiner Certified Analyst, Member, University Professor Posts: 568 Unicorn
    Thanks to both, I didn't know about suffix()!

    I appreciate the timely answers too.

    All the best,

    Rod.
Sign In or Register to comment.