Force minimum of one header row; Add to docs #596
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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