Hello Ben,
I am using Watson studio ML for decision optimization. I have used the below code to get the dataframe output. It's working fine.
My variable name was ProductionPlan (which is multi-index) tuple. Then I convert the tuple list to dataframe. Please go through the below code, which might be helpful for you to get the right dataframe output which is ProductionPlanReport in the below mentioned sample python code.
if mdl.solve():
mdl.float_precision = 3
print("Optimization model has Solution")
mdl.print_solution()
outputs = {}
df_BlendProd = pd.DataFrame({'ProductionPlan': ProductionPlan})
df_BlendProd.index.names=['MixingUnit','Blend','Period']
df_BlendProd=df_BlendProd.ProductionPlan.apply(lambda v: v.solution_value)
df_BlendProd = df_BlendProd[df_BlendProd >0]
outputs['ProductionPlanReport'] = df_BlendProd.reset_index()
------------------------------
Abhaya Sahoo
------------------------------
Original Message:
Sent: Sat February 22, 2020 06:42 PM
From: Ben Howe
Subject: How to export a csv file from Notebook running in Watson Studio
I am running a python notebook in IBM Watson Studio. I can read data files in to work on, but how I export my dataframe as a csv file when I'm finished? I have searched all over the place, but can't find anything.
------------------------------
Ben Howe
------------------------------
#GlobalAIandDataScience
#GlobalDataScience