Vary input files for a Python recipe

DogyDoge02 Registered Posts: 1 ✭✭✭

Hi, I'm new to DSS !

I have a mission where I have to make variable my input files (excel files). I'm going to try to explain you my issue.

I use a Python recipe with 5 input files. First, to try the efficiency of my python recipe, I uploaded my 5 Excel Files in Dataiku with the feature "Upload your files".

However, each day i have to change one of these input file so i wanted to put it in a folder where i can overwrite my file of the past day with the new day. But i don't know how to access to this file in my folder (as input of my python recipe) in my python recipe, taking into account that i want to use this excel file as a Pandas Dataframe in my python recipe.

So, how can i use this file (or another option to make variable this excel file as input without changing manually the input ?

(Sorry for my approximate English).

Thank you,

Best Answer

  • Marlan
    Marlan Neuron 2020, Neuron, Registered, Dataiku Frontrunner Awards 2021 Finalist, Neuron 2021, Neuron 2022, Dataiku Frontrunner Awards 2021 Participant, Neuron 2023 Posts: 317 Neuron
    edited July 17 Answer ✓

    Hi @DogyDoge02

    You are on the right track with using folders. If you haven't yet created one, create a Folder (an option on the + DATASET menu) and upload your files to that folder (rather than using "Upload your files"). Then point your Python recipe to that folder.

    More on how to interact with Folders from Python here:

    I think something like this would work:

    f = dataiku.Folder("folder_name").get_download_stream("inputfile.txt") 
    df = pd.read_excel(f)

    Hope this is helpful.


Setup Info
      Help me…