Survey banner
Switching to Dataiku - a new area to help users who are transitioning from other tools and diving into Dataiku! CHECK IT OUT

Writing multiple files into a folder

Level 1
Writing multiple files into a folder


I would like to write multiple files into a Dataiku folder. Unfortunately, when I do the following, I am getting an error:

data_df = dataiku.Dataset("data")
data = data.get_dataframe()

output = dataiku.Folder("2jiawe32x")

for cnt in
 df = data[ == cnt]
 output.upload_stream(str(cnt), df)


The error that I am getting is:

The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().


Is there any workaround? 

0 Kudos
1 Reply

This happens because you should not directly pass the pandas dataframe as the second argument to the upload_stream method:

Thus, you could do something like:

for cnt in
    df = data[ == cnt]
    output.upload_stream(str(cnt) + ".csv", df.to_csv())


0 Kudos