Skip to content

Python interface to read and write GAMS GDX files using pandas.DataFrames as the intermediate data format.

License

Notifications You must be signed in to change notification settings

NREL/gdx-pandas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gdx-pandas

PyPI Documentation

gdx-pandas is a python package to translate between gdx (GAMS data) and pandas.

Install | Documentation | Uninstall

Install

Preliminaries

  • Python 3.7 or higher (exact compatibility might depend on which GAMS version you are using)
  • pandas (In general you will want the SciPy stack. Anaconda comes with it, or see my notes for Windows.)
  • Install GAMS
  • Put the GAMS directory in your PATH and/or assign it to the GAMS_DIR environment variable
  • GAMS Python bindings
    • See GAMS//apifiles/readme.txt on Windows and Mac, or /opt/gams//apifiles/readme.txt on Linux

    • Run the following for the correct version of the Python bindings (e.g., from the GAMS/**/apifiles/Python/api_39 folder):

      python setup.py install

      or

      python setup.py build --build-base={temporary-path-where-you-have-write-access} install

      with the latter being for the case when you can install packages into Python but don't have GAMS directory write access.

    • If import gdxcc fails (which will also cause import gdxpds to fail) because there "is no _gdxcc module", one workaround is to copy all the _*.pyd (or _*.so) files from GAMS/**/apifiles/Python/api_XX/ and paste them into your Python environment next to, e.g., the gdxcc-8-py3.9.egg file, which on Anaconda is your environment's lib/site-packages directory.

Get the Latest Package

pip install gdxpds

or

pip install git+https://github.com/NREL/[email protected]

or

pip install git+https://github.com/NREL/gdx-pandas.git@main

Versions are listed at pypi and https://github.com/NREL/gdx-pandas/releases.

After installation, you can test the package using pytest:

pytest --pyargs gdxpds

If the tests fail due to permission IOErrors, apply chmod g+x and chmod a+x to the gdx-pandas/gdxpds/test folder.

Uninstall

pip uninstall gdxpds