diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d89251..f0455b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.2.0] - 2024-09-18 00:32:05 + +### Fixed + +- Compatibility with PolicyEngine UK. + ## [1.1.0] - 2024-09-17 18:05:27 ### Changed @@ -19,4 +25,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 +[1.2.0]: https://github.com/PolicyEngine/policyengine-us-data/compare/1.1.0...1.2.0 [1.1.0]: https://github.com/PolicyEngine/policyengine-us-data/compare/1.0.0...1.1.0 diff --git a/changelog.yaml b/changelog.yaml index 317f2a1..b87a3d3 100644 --- a/changelog.yaml +++ b/changelog.yaml @@ -8,3 +8,8 @@ changed: - Lightened dependency list. date: 2024-09-17 18:05:27 +- bump: minor + changes: + fixed: + - Compatibility with PolicyEngine UK. + date: 2024-09-18 00:32:05 diff --git a/policyengine_uk_data/datasets/__init__.py b/policyengine_uk_data/datasets/__init__.py index 72cce9a..5166bfa 100644 --- a/policyengine_uk_data/datasets/__init__.py +++ b/policyengine_uk_data/datasets/__init__.py @@ -5,4 +5,7 @@ FRS_2020_21, FRS_2021_22, FRS_2022_23, + ReweightedFRS_2022_23, + EnhancedFRS_2022_23, + SPI_2020_21, ] diff --git a/policyengine_uk_data/datasets/spi.py b/policyengine_uk_data/datasets/spi.py index 4462225..df83303 100644 --- a/policyengine_uk_data/datasets/spi.py +++ b/policyengine_uk_data/datasets/spi.py @@ -1,5 +1,5 @@ from policyengine_core.data import Dataset -from policyengine_uk.data.storage import STORAGE_FOLDER +from policyengine_uk_data.storage import STORAGE_FOLDER import pandas as pd import numpy as np diff --git a/policyengine_uk_data/utils/imputations/capital_gains.py b/policyengine_uk_data/utils/imputations/capital_gains.py index c4e4551..fcfec08 100644 --- a/policyengine_uk_data/utils/imputations/capital_gains.py +++ b/policyengine_uk_data/utils/imputations/capital_gains.py @@ -3,10 +3,8 @@ # Fit a spline to each income band's percentiles from scipy.interpolate import UnivariateSpline -from policyengine_uk import Microsimulation -from tqdm import tqdm from policyengine_uk_data.storage import STORAGE_FOLDER -from policyengine_uk.system import system +from tqdm import tqdm import copy import torch @@ -24,6 +22,9 @@ def impute_capital_gains(dataset, time_period: int): """Assumes that the capital gains distribution is the same for all years.""" + from policyengine_uk import Microsimulation + from policyengine_uk.system import system + sim = Microsimulation(dataset=dataset) ti = sim.calculate("total_income", time_period) household_weight = sim.calculate("household_weight", time_period).values diff --git a/policyengine_uk_data/utils/loss.py b/policyengine_uk_data/utils/loss.py index dddefe7..163cc7b 100644 --- a/policyengine_uk_data/utils/loss.py +++ b/policyengine_uk_data/utils/loss.py @@ -1,5 +1,4 @@ import numpy as np -from policyengine_uk import Microsimulation import pandas as pd from policyengine_uk_data.storage import STORAGE_FOLDER from policyengine_uk_data.utils import uprate_values @@ -39,6 +38,8 @@ def create_target_matrix( # First- tax-benefit outcomes from the DWP and OBR. + from policyengine_uk import Microsimulation + sim = Microsimulation(dataset=dataset, reform=reform) sim.default_calculation_period = time_period @@ -247,6 +248,8 @@ def pe_count(*variables): def get_loss_results(dataset, time_period, reform=None): matrix, targets = create_target_matrix(dataset, time_period, reform) + from policyengine_uk import Microsimulation + weights = ( Microsimulation(dataset=dataset, reform=reform) .calculate("household_weight", time_period) diff --git a/pyproject.toml b/pyproject.toml index ca7ab03..771b4ea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "policyengine_uk_data" -version = "1.1.0" +version = "1.2.0" description = "A package to create representative microdata for the UK." readme = "README.md" authors = [ @@ -31,6 +31,7 @@ dev = [ "furo", "jupyter-book", "yaml-changelog>=0.1.7", + "itables", ] [tool.setuptools]