sequence generator in prepare receipe

obireddy
obireddy Registered Posts: 13 ✭✭

Hi Team,

Good Morning.

I want add new column to dataset where I need to fill data as unique sequence data combination of both string and numbers like AB1,AB2,AB3, XYZ1,XYZ2,YX1 like.

How can I add new column with data like above.

Thanks in advance.

Tagged:

Answers

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,088 Neuron

    Use a Prepare recipe and Formula processor. You can combine other column values.

  • Rahulvk
    Rahulvk Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 2
    edited July 17

    Here is the python code

    Import pandas as pd
    
    def alpha_sequence(n):
       return ['ab' + str(i) for i in range(1, n+1)]
    
    n = 10000
    sequence = alpha_sequence(n)
    df = pd.DataFrame(sequence, columns=["Unique_id"])
  • obireddy
    obireddy Registered Posts: 13 ✭✭

    How can I put this code in to prepare recipe, to generate sequence numbers for new column?

Setup Info
    Tags
      Help me…