Closed alda982 closed 5 years ago
Your dataframe only has 10 values in it, so when you write it out you get 10 values in the GDX. One way to get more values would be something like data = pds.DataFrame([['u' + str(i), 'k' + str(j), i+j] for i in range(1,11) for j in range(1,11)],
Thanks a million. You are absolutely right! Now it works as I intend it to.
I am meaning to export a 2-dimensional parameter (table) to GAMS. While I am able to actually create a 2-dimensional parameter in GAMS, I am only able to put the values on the diameter. How can I write values for all parts of the table?
Sample output in gdx:
Sample code:
import gdxpds import pandas as pds import numpy as np
out_file = 'my_new_gdx_data.gdx' with gdxpds.gdx.GdxFile() as gdx:
Create a new set with one dimension