Announcing the winners & finalists of the Dataiku Frontrunner Awards 2021! Read their inspiring stories

How to stack multiple datasets using python

PhilippeDulac
Level 1
How to stack multiple datasets using python

Hi,

I need a python script to select my input datasets that I want to stack (I want to stack the same way the stack recipe would do it).
Is there an easy way to stack my dataset once selected in my script. I wouldn't like to do it row by row !

 

Thanks in advance for your help,

 

Philippe

0 Kudos
2 Replies
HarizoR
Dataiker
Dataiker

Hi Philippe,

Your Python recipe can take as many input datasets as you want, each of them yields a Pandas DataFrame that you can manipulate in your code. If you want to stack them, you can use the `pandas.concat` method.

Out of curiosity, what did you find missing in the stack recipe to fall back to a code recipe ?

Best,

Harizo

0 Kudos
PhilippeDulac
Level 1
Author

Hi Harizo,

Thanks for this quick answer. I'll try panda concat and accept the solution 😉

Stack recipe is perfect for most purpose but it have to be linked to "unvariable" input datasets.

With python I'm able to choose my input dataset which are not the same each month ...

Best regards,

 

Philippe

0 Kudos
A banner prompting to get Dataiku DSS