Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run model using data #4

Open
willu47 opened this issue Oct 16, 2020 · 0 comments
Open

Cannot run model using data #4

willu47 opened this issue Oct 16, 2020 · 0 comments

Comments

@willu47
Copy link
Member

willu47 commented Oct 16, 2020

When trying to run OSeMOSYS PuLP for the first time, I get the following error:

python OSeMOSYS_PuLP.py 
INFO:root:2020-10-16 14:07:00	Script started.
Traceback (most recent call last):
  File "/Users/wusher/miniconda3/envs/otoole/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 2891, in get_loc
    return self._engine.get_loc(casted_key)
  File "pandas/_libs/index.pyx", line 70, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 101, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 1675, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 1683, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'REGION'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "OSeMOSYS_PuLP.py", line 427, in <module>
    sets_df, p_df, p_default_df, mcs_df, mcs_num = loadData(inputPath, sheetSets, sheetParams, sheetParamsDefault, sheetMcs, sheetMcsNum)
  File "OSeMOSYS_PuLP.py", line 90, in loadData
    sets_df['REGION'] = sets_df['REGION'].astype(str)
  File "/Users/wusher/miniconda3/envs/otoole/lib/python3.7/site-packages/pandas/core/frame.py", line 2902, in __getitem__
    indexer = self.columns.get_loc(key)
  File "/Users/wusher/miniconda3/envs/otoole/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 2893, in get_loc
    raise KeyError(key) from err
KeyError: 'REGION'

I'm using Python 3.7, pandas 1.1.2 and PuLP 2.3 on OSX.

Looking at the UTOPIA_BASE.xlsx provided, the format of the SET worksheet doesn't seem to match the code. Perhaps the data format needs to be updated?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant