python recipe output to a dataset

ltounsi
Level 1
python recipe output to a dataset

hello i have a list containing items as data frame type i want to make an output to this output as text file or json file if any one can help me please 

0 Kudos
3 Replies
Turribeach

It really depends what you want to do with the file after. Is this a one off export? Why do you need the output as a file? Can you explain your requirement in detail? 

0 Kudos
ltounsi
Level 1
Author

hello @Turribeach  yes please if you can help me 

i want to have as output multiple dataframes in a managed folder if you can please help me 

regards

0 Kudos

The following Python code in a Python recipe will output the contents of the df dataframe to a CSV file:

import dataiku

path_upload_file = "output.csv"
handle = dataiku.Folder("Some Managed Folder")

with handle.get_writer(path_upload_file) as w:
    w.write(df.to_csv().encode('utf-8'))
0 Kudos