fix IndexError with storing net in postgreSQL #64
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.
networks in the future scenarios 1 and 2 contains
%char in the headings of csvStorageProfiles.csvand in the body ofStorage.csv. This leads toIndexError: tuple index out of rangeraised by psycopg2 methodexecute_batchwhich is called from pandapowers functionupload_sql_table.Pandapowers SQL method creates tables for every dataframe in a net-object or in a dict in the net-object. In this way
profiles_storageis created with column names equal to the names in the dataframe.The reasons for the error seems to be, that
execute_batchkind of "counts" the locations where to put values in the sql string by the number or%in the base sql string. Since the names of StorageProfiles contains%it tries to access more items in the tuple of values than the tuple contains.with the PR, the
%in all profile names (only occurs in Storages) are replaced bypr.