Data Structure Handling Issues in EmbeddedCode Facility [Python]

Problems with syntax of GAMS
Post Reply
Jubeyer
User
User
Posts: 32
Joined: 1 year ago

Data Structure Handling Issues in EmbeddedCode Facility [Python]

Post by Jubeyer » 3 months ago

Hi,
I am using the EmbeddedCode Facility of GAMS and using a python script which is supposed to process some data obtained from the optimization problem solution. For that I need to pass two parameters to the embedded section; one of them is this:
image.png
and another one is this
image.png
:
Then I use them to do some calculation when they are processed like this:

profiles_source=pd.DataFrame(list(gams.get('NUCLEAR_SCHEDULE')))
profiles_sink=pd.DataFrame(list(gams.get('DH_LOAD')))

And I am having some errors like this:
Exception from Python: "None of [Index(['0'], dtype='object')] are in the [index]"

I am assuming since the indexing of python starts from zero, and perhaps while converting those parameters to dataframe their initial indices will be zero. Is it what causing the issue?
I am also trying to take out two parameters from the calculation in embedded section and in GAMS they are declared over the similar interval indices as DH_LOAD; but while python process and returns their values they will be indexed from zero and onwards, what could be the workaround for this problem (if it is a problem)?

Best Regards,
Jubeyer

Post Reply