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

Fix KeyError retrieving marginal costs #651

Merged
merged 1 commit into from
Sep 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions etrago/tools/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -2624,12 +2624,7 @@ def adjust_CH4_gen_carriers(self):
FROM scenario.egon_scenario_parameters
WHERE name = '{self.args["scn_name"]}';"""
df = pd.read_sql(sql, engine)
# TODO: There might be a bug in here raising a `KeyError`.
# If you encounter it, that means you have live data
# to test against. Please do a `git blame` on these
# lines and follow the hints in the commit message to
# fix the bug.
marginal_cost = df["marginal_cost"]
marginal_cost = df["gas_parameters"][0]["marginal_cost"]
except sqlalchemy.exc.ProgrammingError:
marginal_cost = marginal_cost_def

Expand Down