How to save a dataframe as a csv in a managed folder?

Usersyed Partner, Registered Posts: 29 Partner

Hi all,

I want to save a dataframe as a csv in a managed folder inside my Dataiku project.

To read files from the managed folder, I usually use this code (because my script is deployed as an API inside Dataiku)

folder_path = folders[0]

path_of_file = os.path.join(folder_path, "file_name_with_extension")

df = pd.read_csv(path_of_file)

But how about saving a dataframe as a csv in the managed folder?

Can someone please help me with this?


Operating system used: Windows


Best Answer

  • FlorentD
    FlorentD Dataiker, Dataiku DSS Core Designer Posts: 25 Dataiker
    edited July 17 Answer ✓


    Maybe I am wrong or don't understand the problem.

    You have nothing more to do than writing to the managed folder, with the pandas library. You just have to change the name of the file, if you want to.

    Did you try?

    path_of_copy = os.path.join(folder_path, "copy_file_name_with_extension")

    Hope this helps.



  • ssuhas76
    ssuhas76 Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Registered Posts: 31

    Does the same code work for storing a csv file into a managed folder. I need to do this via Python API endpoint function

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,737 Neuron

    When you say via Python API endpoint function what exactly do you mean? API endpoint function means to me an API you have developed and deployed in the Dataiku API node. If you don’t mean that please explain.

Setup Info
      Help me…