python recipe output to a dataset
![ltounsi](https://us.v-cdn.net/6038231/uploads/Dataiku/nAvatar12.png)
ltounsi
Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 3 ✭
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
Tagged:
Answers
-
Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,876 Neuron
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?
-
ltounsi Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 3 ✭
hello @Turribeach
yes please if you can help mei want to have as output multiple dataframes in a managed folder if you can please help me
regards
-
Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,876 Neuron
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'))