Skip to main content

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

Project description

GDX2py

Documentation Status

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

Requirements

  • GAMS: version 47.0 or higher
  • Python: 3.8 or higher

Installing GAMS

Get GAMS from https://www.gams.com/download/ and install it to your system. No license is needed for the use of GDX libraries.

Installation

Install with

pip install gdx2py

Usage

>>> 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 }, 
                                    domain=['set1'])  

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 gamsapi.core.gdx module which is part of the GAMS Python API (gamsapi) 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


Download files

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

Source Distribution

gdx2py-2.2.0.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

GDX2py-2.2.0-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file gdx2py-2.2.0.tar.gz.

File metadata

  • Download URL: gdx2py-2.2.0.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for gdx2py-2.2.0.tar.gz
Algorithm Hash digest
SHA256 2397df573878d24cacfd4eb835b532bed4d7a6d70bbd35c5d9121660a379d0ab
MD5 5eb9704126aedde9278b5733743c3ae5
BLAKE2b-256 bf84b520b039b018adbab22b32d2f9ff11b0f9bceaa8c99357f886e6301597af

See more details on using hashes here.

File details

Details for the file GDX2py-2.2.0-py3-none-any.whl.

File metadata

  • Download URL: GDX2py-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for GDX2py-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a36b5090312c9c242adbbb5edb0c82db88a6017ea06e8513e2f83c8e17bce8a3
MD5 c3c10560d422fa2597e53f767cea9974
BLAKE2b-256 b0c74f4633141ad31701e097ea351b7041df31c81ed682251a69ba7294c9bafa

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page