You now have until September 15th to submit your use case or success story to the 2022 Dataiku Frontrunner Awards!ENTER YOUR SUBMISSION

Vary input files for a Python recipe

Solved!
DogyDoge02
Level 1
Vary input files for a Python recipe

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,

0 Kudos
1 Solution
Marlan
Neuron
Neuron

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: https://doc.dataiku.com/dss/latest/connecting/managed_folders.html

I think something like this would work:

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

 

Hope this is helpful.

Marlan

View solution in original post

0 Kudos
1 Reply
Marlan
Neuron
Neuron

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: https://doc.dataiku.com/dss/latest/connecting/managed_folders.html

I think something like this would work:

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

 

Hope this is helpful.

Marlan

0 Kudos