Read and write GAMS Data eXchange (GDX) files using Python
Project description
GDX2py
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.
|
|
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2397df573878d24cacfd4eb835b532bed4d7a6d70bbd35c5d9121660a379d0ab
|
|
| MD5 |
5eb9704126aedde9278b5733743c3ae5
|
|
| BLAKE2b-256 |
bf84b520b039b018adbab22b32d2f9ff11b0f9bceaa8c99357f886e6301597af
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a36b5090312c9c242adbbb5edb0c82db88a6017ea06e8513e2f83c8e17bce8a3
|
|
| MD5 |
c3c10560d422fa2597e53f767cea9974
|
|
| BLAKE2b-256 |
b0c74f4633141ad31701e097ea351b7041df31c81ed682251a69ba7294c9bafa
|