Skip to content

Commit

Permalink
Fix simulation to allow a dict for dataset
Browse files Browse the repository at this point in the history
fixes 53

in the example from index.ipnyb we use dataset as a dict for household
cacluations.

In the code we were failing to correctly handle this case.

This happening, in part, because the type hint was wrong, but since most
of the type hints are wrong I'm fixing the bug first and will come back
to address the type hints.
  • Loading branch information
EC2 Default User committed Dec 5, 2024
1 parent b7cbaeb commit 999a4a7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions policyengine/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ def __init__(
self._initialise_simulations()

def _set_dataset(self, dataset: str):
if isinstance(dataset, dict):
self.data = dataset
return

if dataset in DATASETS[self.country]:
self.data = DATASETS[self.country][dataset]
elif dataset is None:
Expand Down

0 comments on commit 999a4a7

Please sign in to comment.