NREL / gdx-pandas

Python interface to read and write GAMS GDX files using pandas.DataFrames as the intermediate data format.
BSD 3-Clause "New" or "Revised" License
43 stars 15 forks source link

gdxpds.to_gdx changing dataframe order #75

Open DIUANA opened 4 years ago

DIUANA commented 4 years ago

Hi all I hope you are all fine and sage.

I am facing an issue when generating a gdx file with gdxpds.to_gdx function.

I am passing a dictionary with 198 keys and when generating the gdx it is modifyig the order of some sets.

For instance I am providing a dataframe such as this one:

2008 True 2010 True 2015 True 2020 True

And the gdx output is:

2010 Y 2015 Y 2020 Y 2008 Y

It makes difference for the current model I am working on.

Is there any way to keep the passed order when generating the gdx file with gdxpds.to_gdx?

Thanks in advance

Version info: Python 3.7 GAMS 24.7.4 GAMS 29.1 gdxpds 1.1.0

Edit: I have also tried to implement the backend conversion but it provided me the same output issues.

jebob commented 3 years ago

Can you provide a minimum example?

EDIT: I am guessing that this is due to the UEL being constructed from sets in a particular order.