KeyError: not in index during Output selection

54 views
Skip to first unread message

Alaize Dall'Orsoletta

unread,
Jun 27, 2022, 1:10:23 PM6/27/22
to MUSE
Hello everyone,

When trying to change the columns in the output .csv files using the structure below, I got: KeyError(f"{not_found} not in index"). 

[[outputs]]
quantity = "fuel_costs"
sink = "aggregate"
filename = "{path}/{default_output_dir}/MCA{Quantity}.csv"
columns = ["region", "agent", "technology", "year", "timeslices", "category", "fuel_consumption_costs"]

For this particular case: KeyError: "['timeslices'] not in index"

I have checked the documentation but I don't know how to solve this issue. I hope someone can help.

Many thanks.

Alaize

sgiarols

unread,
Jun 28, 2022, 2:12:35 AM6/28/22
to MUSE
Dear Alaize

the documentation describes how to add and manipulate more output in this section

In general, there is a good potential to modify the output. The output needs to be defined (in this case fuel_costs), it is aggregated over the sectors ("aggregate"), and it is assigned a path plus a list f columns to report (columns). The error means that you are trying to report a quantity not found in the columns, either because it is in fact not there or because of a misspelling (which seems this case).
I am not sure how you would like to change the output, but changing "timeslices" into "timeslice" would solve the KeyError.
I hope this helps.

Best
Sara

Diego Moya

unread,
May 9, 2023, 1:39:01 AM5/9/23
to MUSE
Dear Sara, 

I am running the default examples in  src\muse\data\OS_case_studies.
In the 4 cases, I got the following error: KeyError: "['technology'] not in index"

Is this an issue with the tolm file declaration or with an input file?
I have checked the spelling and did not find it as one of the issues.

I appreciate your help on this matter.

Best regards,

Diego

sgiarols

unread,
May 10, 2023, 2:35:05 AM5/10/23
to MUSE
Dear Diego
there is not a lot of information for debugging. A first thing to say is that the files were reflected a version of the case studies used for a former 
These lines in the outputs which refer to the sectoral outputs, should be removed, as they are not used in the current version of the model. The same applies for gas)


[[sectors.power.outputs]]
filename = '{path}/{default_output_dir}/BUDGET/ADHOC_0307/{Sector}/{Quantity}/{year}{suffix}'
quantity = "capacity"
sink = 'csv'
overwrite = true

[[sectors.power.outputs]]
filename = '{path}/{default_output_dir}/BUDGET/ADHOC_0307/{Sector}/{Quantity}/{year}{suffix}'
quantity.name = "supply"
quantity.sum_over = "timeslice"
quantity.drop = ["comm_usage", "units_prices"]
columns = ["commodity", "region", "technology", "year", "supply"]
sink = 'csv'
overwrite = true

[[sectors.power.outputs]]
filename = '{path}/{default_output_dir}/BUDGET/ADHOC_0307/{Sector}/{Quantity}/{year}{suffix}'
quantity.name = "consumption"
quantity.sum_over = "timeslice"
quantity.drop = ["comm_usage", "units_prices"]
columns = ["commodity", "region", "technology", "year", "consumption"]
sink = 'csv'
overwrite = true
Reply all
Reply to author
Forward
0 new messages