input from dataset and dump output in folder
Swapnali
Registered Posts: 38 ✭✭✭✭
Hi Team,
How can I dump the value of string datatype from a dataset(excel format) to the folder in text file format using python?
like :FROM:
path | text |
mv.wav | sdmgggggggggmgjsgajdmkdj |
now I want to create a text file(mv.txt) for the value of text column and save it in
TO: the folder named Data, with hierarchy: Data\test\pos\mv.txt
Kindly help us and thanks in advance.
Answers
-
Hi,
Based on what you describe I would suggest to:
- create the proper filesystem connection corresponding to the root folder where you want to store the files (based on your example, it could be Data or Data\test or Data\test\pos
- please not that you can also specify a path from this root folder in the settings of the Folder that is created in the next step
- create a python recipe with a folder output based on the previous connection. The generated code snippet will provide you objects to get started:
- the input dataset: you'll find the documentation on how to interact with a dataset here => https://doc.dataiku.com/dss/latest/python-api/datasets.html
- the output folder: you'll find the documentation on how to interact with a folder here => https://doc.dataiku.com/dss/latest/python-api/managed_folders.html
- more specifically you could use the following method to write your text file: https://doc.dataiku.com/dss/latest/python-api/managed_folders.html#dataiku.Folder.get_writer
- you will find an example in this section: https://doc.dataiku.com/dss/latest/connecting/managed_folders.html?highlight=get_writer#usage-in-python (see "To write a file in the folder")
- code inside this python recipe the logic that corresponds to your need based on the input dataset
I hope this helps.
Regards,
- create the proper filesystem connection corresponding to the root folder where you want to store the files (based on your example, it could be Data or Data\test or Data\test\pos
-
found solution but could not delete this comment.