Replace python code with recipe

Linda97
Linda97 Registered Posts: 4

Can I replace this code with recipe ?

i=0
for c in xxx:
if c not in Data_df.columns:
Data_df[c] = 0

Thanks

Answers

  • Shashank
    Shashank Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 28 Dataiker

    Yes, you can convert this as a recipe, with the input dataset as the dataset you want to check the column "c" and output as the column with value "c" as 0

    A recipe needs at least one output (Dataset, File , Saved Model etc.) associated with it.

  • Sv3n-Sk4
    Sv3n-Sk4 Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 32 ✭✭✭✭

    The way I understand your question @Linda97
    is :

    Is there a recipe that will allow me to replace my existing code in the goal to fill every column you choose with a 0 ?

    If I understood it correctly, you can use a prepare recipe and use the "Fill Column" processor and choose every column you want with a Value 0.

    https://doc.dataiku.com/dss/latest/preparation/processors/fill-column.html

    Hope it helped

Setup Info
    Tags
      Help me…