Skip to content

Commit

Permalink
Fix Enum bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilwoodruff committed Jul 31, 2024
1 parent 4b98c95 commit 02b5695
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion policyengine_core/enums/enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def encode(cls, array: Union[EnumArray, np.ndarray]) -> EnumArray:
# Confusingly, Numpy uses "S" to refer to byte-string arrays
# and "U" to refer to Unicode-string arrays, which are also
# referred to as the "str" type
if array.dtype.kind == "S":
if array.dtype.kind == "S" or array.dtype == object:
# Convert boolean array to string array
array = array.astype(str)

Expand Down
1 change: 1 addition & 0 deletions policyengine_core/simulations/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ def build_from_dataset(self) -> None:
else:
entity_level_data = data[variable]

print(f"Setting {variable} in {time_period} to {data[variable]}")
self.set_input(variable, time_period, entity_level_data)

self.default_calculation_period = (
Expand Down

0 comments on commit 02b5695

Please sign in to comment.