split years from one cell to multiple cell

jasonsnare
jasonsnare Registered Posts: 4 ✭✭✭

HI,

I have one dataset and it contains the year ranges in one cell (1993-1996). I want to split each year into separate cells (1993,1994,1995,1996). Does anyone have an Idea suggest me.

Tagged:

Answers

  • Rushil09
    Rushil09 Partner, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered, Frontrunner 2022 Participant Posts: 17 Partner

    Hi,

    How exactly will the cells be laid out? in form of columns?

    Can you sen the screenshot of what you want to do if i am getting this wrong.

  • AlexGo
    AlexGo Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 18 Dataiker

    If you want to use the visual recipe steps and you have a consistent format, you could do something like:

    1. Split the cell on '-',
    2. Use a formula such as "forRange(year_range_0,year_range_1, 1+1, v, v)"
    3. Unnest the array into separate columns

    Screen Shot 2022-04-12 at 9.31.25 AM.png

    This gets the first and last year, takes all years between the first and the last, steps through each year and then applies a formula to it (in this case the formula is just returning the value).

    You might have issues if the format is inconsistent though e.g. there's a single year. You would have to edit the formula step to include an 'if' to check for things like this.

Setup Info
    Tags
      Help me…