Based on the decision in #573, I have forced the need for a header row by setting header=[0] if a user does not provide columns data in their data source config.
It can lead to a difficult to understand failure. When a user forgets a header row, data ends up as the column / index level names. This gets picked up later when Calliope tries to match index/column levels to what has been defined in the config. That seems to be the only place we can catch it, but it leads to an error like this:
calliope.exceptions.ModelError: (data_sources, ds_name) | Trying to set names for index but names in the file do no match names provided | in file: ['bar1', 'bar2'] | defined: ['test_row1', 'test_row2'].
Maybe just adding to that error with something like "Make sure you have a header row in your CSV file"?
Summary of changes in this pull request
Force header=[0] as a minimum
Added to docs with a bit about how to structure the CSV
Fixes #573
Based on the decision in #573, I have forced the need for a header row by setting
header=[0]
if a user does not providecolumns
data in their data source config.It can lead to a difficult to understand failure. When a user forgets a header row, data ends up as the column / index level names. This gets picked up later when Calliope tries to match index/column levels to what has been defined in the config. That seems to be the only place we can catch it, but it leads to an error like this:
calliope.exceptions.ModelError: (data_sources, ds_name) | Trying to set names for index but names in the file do no match names provided | in file: ['bar1', 'bar2'] | defined: ['test_row1', 'test_row2'].
Maybe just adding to that error with something like "Make sure you have a header row in your CSV file"?
Summary of changes in this pull request
Reviewer checklist