Skip to content

Commit

Permalink
Update json_dict_to_dataframe delimiter to ":" rather than "-" to avo… (
Browse files Browse the repository at this point in the history
#129)

* Update json_dict_to_dataframe delimiter to ":" rather than "-" to avoid issues

* Add check if ":" in id

* Roll back check if ":" in id
  • Loading branch information
edwardxtg authored Jul 23, 2024
1 parent 4bdb9e4 commit 42ba3e3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tz/osemosys/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def json_dict_to_dataframe(data, prefix=""):
# If data is a dictionary, iterate through its items
result = pd.DataFrame()
for key, value in data.items():
new_prefix = f"{prefix}-{key}" if prefix else key
new_prefix = f"{prefix}:{key}" if prefix else key
df = json_dict_to_dataframe(value, new_prefix)
result = pd.concat([result, df], axis=1)
if (
Expand All @@ -296,7 +296,7 @@ def json_dict_to_dataframe(data, prefix=""):
result = result.T
result = result.reset_index()

result = pd.concat([result["index"].str.split("-", expand=True), result[0]], axis=1)
result = pd.concat([result["index"].str.split(":", expand=True), result[0]], axis=1)
return result
else:
return result
Expand Down

0 comments on commit 42ba3e3

Please sign in to comment.