Skip to content

Commit

Permalink
fix index name error
Browse files Browse the repository at this point in the history
  • Loading branch information
savente93 committed Aug 28, 2023
1 parent 14fe66e commit acb5abf
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions hydromt/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,17 +286,6 @@ def open_mfcsv(
if variable_axis == 0:
df = df.T

if segmented_by == "id":
df[concat_dim] = id
elif segmented_by == "var":
df["var"] = id
df = df.reset_index().melt(id_vars=["var", "time"], var_name=concat_dim)
else:
raise RuntimeError(
"Reached unknown segmentation branch (this should be impossible):"
f" {segmented_by}, options are ['var','id']"
)

if csv_index_name is None:
# we're in the first loop
if df.index.name is None:
Expand All @@ -319,6 +308,17 @@ def open_mfcsv(
f"expected {csv_index_name} as it's the first one found."
)

if segmented_by == "id":
df[concat_dim] = id
elif segmented_by == "var":
df["var"] = id
df = df.reset_index().melt(id_vars=["var", "time"], var_name=concat_dim)
else:
raise RuntimeError(
"Reached unknown segmentation branch (this should be impossible):"
f" {segmented_by}, options are ['var','id']"
)

dfs.append(df)

if segmented_by == "id":
Expand Down

0 comments on commit acb5abf

Please sign in to comment.