Skip to content

Commit

Permalink
chore: drop id col and reset when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Hagg committed Jan 6, 2021
1 parent 79383c9 commit 6149e15
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion powersimdata/data_access/csv_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def _parse_csv(self, file_object):
:return: (*pandas.DataFrame*) -- the specified file as a data frame.
"""
table = pd.read_csv(file_object)
table.set_index("id", inplace=True, drop=False)
table.set_index("id", inplace=True)
table.fillna("", inplace=True)
return table.astype(str)

Expand Down
6 changes: 5 additions & 1 deletion powersimdata/data_access/scenario_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,11 @@ def err_message(text):
print(f"Duplicate ids: {dupes}")
print("Use id to access scenario")
else:
return scenario.to_dict("records", into=OrderedDict)[0]
return (
scenario.reset_index()
.astype({"id": "str"})
.to_dict("records", into=OrderedDict)[0]
)

def add_entry(self, scenario_info):
"""Adds scenario to the scenario list file on server.
Expand Down

0 comments on commit 6149e15

Please sign in to comment.