Skip to content

Commit

Permalink
Raise error when parameters csv file contains strings instead of numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
xjules committed Oct 11, 2023
1 parent d5bee55 commit ae27fe2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/ert/config/gen_kw_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,13 @@ def _values_from_file(
# We need to sort the user input keys by the
# internal order of sub-parameters:
df = df.set_index(df.columns[0])
return df.reindex(keys).values.flatten()
return df.values.flatten()
return df.reindex(keys).values.flatten() # type: ignore

if not np.issubdtype(df.dtype, np.number):
raise ValueError(
f"Entries in the {file_name} need to be numbers not strings!"
)
return df.values.flatten() # type: ignore

@staticmethod
def _sample_value(
Expand Down

0 comments on commit ae27fe2

Please sign in to comment.