Skip to main content

Read and write GAMS Data eXchange (GDX) files using Python

Project description


Documentation Status

Read and write GAMS Data eXchange (GDX) files using Python.


  • GAMS: version 24.1 or higher
  • Python: 3.6 or higher
  • GAMS Data Exchange API (gdxcc): 7.0 or higher

Installing GAMS

Get GAMS from and install it to your system. No license is needed for the use of GDX libraries.


Install with

pip install [-e] git+

Use the -e switch to install in editable mode (for development).


>>> from gdx2py import GdxFile, GAMSSet, GAMSScalar, GAMSParameter
>>> with GdxFile('/path/to/gdx/file.gdx', mode='w') as gdx:
>>>     gdx['set1'] = ['a', 'b', 'c']  # Write a simple set
>>>     set1 = gdx['set1']  # Read a symbol
>>>     # Write a 2-dimensional set
>>>     gdx['set2'] = [('a', 'foo'), ('b', 'bar'), ('c', 'baz')]
>>>     # Write a scalar with explanatory text
>>>     gdx['scalar'] = GAMSScalar(3.14, expl_text="Value of pi")  
>>>     # Write a parameter with domain                                     
>>>     gdx['par1'] = GAMSParameter({'a': 1, 'b': 2,  
                                     'c': 3, 'd': 4 }, 

Comparison to similar packages

Compared to other packages like PyGDX, gdx-pandas, gdxtools and gdxpy, GDX2py relies only on the Python standard library and the low-level GDX API gdxcc package which is available on PyPI.

EU emblem This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 774629.

Project details

Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for GDX2py, version 2.0.0
Filename, size File type Python version Upload date Hashes
Filename, size GDX2py-2.0.0.tar.gz (9.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page