diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29b..1fa7f744 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: minor + changes: + fixed: + - Bug causing subsample to not work in some situations. diff --git a/policyengine_core/simulations/simulation.py b/policyengine_core/simulations/simulation.py index 482c90e4..a18312c2 100644 --- a/policyengine_core/simulations/simulation.py +++ b/policyengine_core/simulations/simulation.py @@ -1549,6 +1549,14 @@ def subsample( # Update the dataset and rebuild the simulation self.dataset = Dataset.from_dataframe(df, self.dataset.time_period) self.build_from_dataset() + + # Ensure the baseline branch has the new data. + if "baseline" in self.branches: + baseline_tax_benefit_system = self.branches[ + "baseline" + ].tax_benefit_system + self.branches["baseline"] = self.clone() + self.branches["tax_benefit_system"] = baseline_tax_benefit_system return self