Replace python code with recipe

Linda97
Level 2
Replace python code with recipe

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

 

 

 

0 Kudos
2 Replies
shashank
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.

0 Kudos
Sv3n-Sk4
Level 3

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 🙂