policyengine 3.1.4__tar.gz → 3.1.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. {policyengine-3.1.4 → policyengine-3.1.5}/CHANGELOG.md +7 -0
  2. {policyengine-3.1.4 → policyengine-3.1.5}/PKG-INFO +1 -1
  3. {policyengine-3.1.4 → policyengine-3.1.5}/changelog.yaml +5 -0
  4. {policyengine-3.1.4 → policyengine-3.1.5}/pyproject.toml +1 -1
  5. policyengine-3.1.5/src/policyengine/__pycache__/__init__.cpython-313.pyc +0 -0
  6. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/core/dataset.py +21 -5
  7. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine.egg-info/PKG-INFO +1 -1
  8. policyengine-3.1.4/src/policyengine/__pycache__/__init__.cpython-313.pyc +0 -0
  9. {policyengine-3.1.4 → policyengine-3.1.5}/.claude/policyengine-guide.md +0 -0
  10. {policyengine-3.1.4 → policyengine-3.1.5}/.claude/quick-reference.md +0 -0
  11. {policyengine-3.1.4 → policyengine-3.1.5}/.github/CONTRIBUTING.md +0 -0
  12. {policyengine-3.1.4 → policyengine-3.1.5}/.github/changelog_template.md +0 -0
  13. {policyengine-3.1.4 → policyengine-3.1.5}/.github/fetch_version.py +0 -0
  14. {policyengine-3.1.4 → policyengine-3.1.5}/.github/get-changelog-diff.sh +0 -0
  15. {policyengine-3.1.4 → policyengine-3.1.5}/.github/has-functional-changes.sh +0 -0
  16. {policyengine-3.1.4 → policyengine-3.1.5}/.github/is-version-number-acceptable.sh +0 -0
  17. {policyengine-3.1.4 → policyengine-3.1.5}/.github/publish-git-tag.sh +0 -0
  18. {policyengine-3.1.4 → policyengine-3.1.5}/.github/workflows/code_changes.yaml +0 -0
  19. {policyengine-3.1.4 → policyengine-3.1.5}/.github/workflows/docs.yml +0 -0
  20. {policyengine-3.1.4 → policyengine-3.1.5}/.github/workflows/pr_code_changes.yaml +0 -0
  21. {policyengine-3.1.4 → policyengine-3.1.5}/.github/workflows/pr_docs_changes.yaml +0 -0
  22. {policyengine-3.1.4 → policyengine-3.1.5}/.github/workflows/versioning.yaml +0 -0
  23. {policyengine-3.1.4 → policyengine-3.1.5}/.gitignore +0 -0
  24. {policyengine-3.1.4 → policyengine-3.1.5}/CLAUDE.md +0 -0
  25. {policyengine-3.1.4 → policyengine-3.1.5}/LICENSE +0 -0
  26. {policyengine-3.1.4 → policyengine-3.1.5}/Makefile +0 -0
  27. {policyengine-3.1.4 → policyengine-3.1.5}/README.md +0 -0
  28. {policyengine-3.1.4 → policyengine-3.1.5}/changelog_entry.yaml +0 -0
  29. {policyengine-3.1.4 → policyengine-3.1.5}/docs/.gitignore +0 -0
  30. {policyengine-3.1.4 → policyengine-3.1.5}/docs/core-concepts.md +0 -0
  31. {policyengine-3.1.4 → policyengine-3.1.5}/docs/country-models-uk.md +0 -0
  32. {policyengine-3.1.4 → policyengine-3.1.5}/docs/country-models-us.md +0 -0
  33. {policyengine-3.1.4 → policyengine-3.1.5}/docs/dev.md +0 -0
  34. {policyengine-3.1.4 → policyengine-3.1.5}/docs/index.md +0 -0
  35. {policyengine-3.1.4 → policyengine-3.1.5}/docs/myst.yml +0 -0
  36. {policyengine-3.1.4 → policyengine-3.1.5}/docs/visualisation.md +0 -0
  37. {policyengine-3.1.4 → policyengine-3.1.5}/examples/employment_income_variation_uk.py +0 -0
  38. {policyengine-3.1.4 → policyengine-3.1.5}/examples/employment_income_variation_us.py +0 -0
  39. {policyengine-3.1.4 → policyengine-3.1.5}/examples/income_bands_uk.py +0 -0
  40. {policyengine-3.1.4 → policyengine-3.1.5}/examples/income_distribution_us.py +0 -0
  41. {policyengine-3.1.4 → policyengine-3.1.5}/examples/policy_change_uk.py +0 -0
  42. {policyengine-3.1.4 → policyengine-3.1.5}/examples/speedtest_us_simulation.py +0 -0
  43. {policyengine-3.1.4 → policyengine-3.1.5}/setup.cfg +0 -0
  44. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/__init__.py +0 -0
  45. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/core/__init__.py +0 -0
  46. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/core/dataset_version.py +0 -0
  47. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/core/dynamic.py +0 -0
  48. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/core/output.py +0 -0
  49. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/core/parameter.py +0 -0
  50. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/core/parameter_value.py +0 -0
  51. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/core/policy.py +0 -0
  52. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/core/simulation.py +0 -0
  53. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/core/tax_benefit_model.py +0 -0
  54. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/core/tax_benefit_model_version.py +0 -0
  55. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/core/variable.py +0 -0
  56. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/outputs/__init__.py +0 -0
  57. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/outputs/aggregate.py +0 -0
  58. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/outputs/change_aggregate.py +0 -0
  59. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/outputs/decile_impact.py +0 -0
  60. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/tax_benefit_models/uk/__init__.py +0 -0
  61. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/tax_benefit_models/uk/analysis.py +0 -0
  62. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/tax_benefit_models/uk/datasets.py +0 -0
  63. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/tax_benefit_models/uk/model.py +0 -0
  64. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/tax_benefit_models/uk/outputs.py +0 -0
  65. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/tax_benefit_models/uk.py +0 -0
  66. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/tax_benefit_models/us/__init__.py +0 -0
  67. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/tax_benefit_models/us/analysis.py +0 -0
  68. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/tax_benefit_models/us/datasets.py +0 -0
  69. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/tax_benefit_models/us/model.py +0 -0
  70. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/tax_benefit_models/us/outputs.py +0 -0
  71. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/tax_benefit_models/us.py +0 -0
  72. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/utils/__init__.py +0 -0
  73. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/utils/dates.py +0 -0
  74. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/utils/parametric_reforms.py +0 -0
  75. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine/utils/plotting.py +0 -0
  76. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine.egg-info/SOURCES.txt +0 -0
  77. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine.egg-info/dependency_links.txt +0 -0
  78. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine.egg-info/requires.txt +0 -0
  79. {policyengine-3.1.4 → policyengine-3.1.5}/src/policyengine.egg-info/top_level.txt +0 -0
  80. {policyengine-3.1.4 → policyengine-3.1.5}/tests/test_aggregate.py +0 -0
  81. {policyengine-3.1.4 → policyengine-3.1.5}/tests/test_change_aggregate.py +0 -0
  82. {policyengine-3.1.4 → policyengine-3.1.5}/tests/test_entity_mapping.py +0 -0
  83. {policyengine-3.1.4 → policyengine-3.1.5}/tests/test_get_parameter_variable.py +0 -0
  84. {policyengine-3.1.4 → policyengine-3.1.5}/tests/test_uk_dataset.py +0 -0
  85. {policyengine-3.1.4 → policyengine-3.1.5}/tests/test_us_datasets.py +0 -0
  86. {policyengine-3.1.4 → policyengine-3.1.5}/tests/test_us_entity_mapping.py +0 -0
  87. {policyengine-3.1.4 → policyengine-3.1.5}/tests/test_us_simulation.py +0 -0
  88. {policyengine-3.1.4 → policyengine-3.1.5}/uv.lock +0 -0
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.1.5] - 2025-11-21 12:59:36
9
+
10
+ ### Fixed
11
+
12
+ - Minor fixes
13
+
8
14
  ## [3.1.4] - 2025-11-20 14:06:49
9
15
 
10
16
  ### Fixed
@@ -221,6 +227,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
221
227
 
222
228
 
223
229
 
230
+ [3.1.5]: https://github.com/PolicyEngine/policyengine.py/compare/3.1.4...3.1.5
224
231
  [3.1.4]: https://github.com/PolicyEngine/policyengine.py/compare/3.1.3...3.1.4
225
232
  [3.1.3]: https://github.com/PolicyEngine/policyengine.py/compare/3.1.2...3.1.3
226
233
  [3.1.2]: https://github.com/PolicyEngine/policyengine.py/compare/3.1.1...3.1.2
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: policyengine
3
- Version: 3.1.4
3
+ Version: 3.1.5
4
4
  Summary: A package to conduct policy analysis using PolicyEngine tax-benefit models.
5
5
  Author-email: PolicyEngine <hello@policyengine.org>
6
6
  License: GNU AFFERO GENERAL PUBLIC LICENSE
@@ -180,3 +180,8 @@
180
180
  fixed:
181
181
  - Minor fixes
182
182
  date: 2025-11-20 14:06:49
183
+ - bump: patch
184
+ changes:
185
+ fixed:
186
+ - Minor fixes
187
+ date: 2025-11-21 12:59:36
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "policyengine"
7
- version = "3.1.4"
7
+ version = "3.1.5"
8
8
  description = "A package to conduct policy analysis using PolicyEngine tax-benefit models."
9
9
  readme = "README.md"
10
10
  authors = [
@@ -1,5 +1,6 @@
1
1
  from uuid import uuid4
2
2
 
3
+ import numpy as np
3
4
  import pandas as pd
4
5
  from microdf import MicroDataFrame
5
6
  from pydantic import BaseModel, ConfigDict, Field
@@ -100,7 +101,7 @@ def map_to_entity(
100
101
  target_entity: str,
101
102
  person_entity: str = "person",
102
103
  columns: list[str] | None = None,
103
- values: list | None = None,
104
+ values: np.ndarray | None = None,
104
105
  how: str = "sum",
105
106
  ) -> MicroDataFrame:
106
107
  """Map data from source entity to target entity using join keys.
@@ -143,6 +144,9 @@ def map_to_entity(
143
144
  # Get source data (convert to plain DataFrame to avoid weighted operations during mapping)
144
145
  source_df = pd.DataFrame(entity_data[source_entity])
145
146
 
147
+ # Track if we should return a MicroSeries (values is a numpy array, not a list)
148
+ return_series = values is not None
149
+
146
150
  # Handle values parameter - create a temporary column with the provided values
147
151
  if values is not None:
148
152
  if len(values) != len(source_df):
@@ -166,7 +170,10 @@ def map_to_entity(
166
170
 
167
171
  # Same entity - return as is
168
172
  if source_entity == target_entity:
169
- return MicroDataFrame(source_df, weights=target_weight)
173
+ result = MicroDataFrame(source_df, weights=target_weight)
174
+ if return_series:
175
+ return result["__mapped_value"]
176
+ return result
170
177
 
171
178
  # Get target data and key
172
179
  target_df = entity_data[target_entity]
@@ -225,7 +232,10 @@ def map_to_entity(
225
232
  # Fill NaN with 0 for groups with no members in source entity
226
233
  result[agg_cols] = result[agg_cols].fillna(0)
227
234
 
228
- return MicroDataFrame(result, weights=target_weight)
235
+ result_df = MicroDataFrame(result, weights=target_weight)
236
+ if return_series:
237
+ return result_df["__mapped_value"]
238
+ return result_df
229
239
 
230
240
  # Group entity to person: expand group-level data to person level
231
241
  if source_entity != person_entity and target_entity == person_entity:
@@ -284,7 +294,10 @@ def map_to_entity(
284
294
  f"Unsupported aggregation method for group->person: {how}. Use 'project' or 'divide'."
285
295
  )
286
296
 
287
- return MicroDataFrame(result, weights=target_weight)
297
+ result_df = MicroDataFrame(result, weights=target_weight)
298
+ if return_series:
299
+ return result_df["__mapped_value"]
300
+ return result_df
288
301
 
289
302
  # Group to group: go through person table
290
303
  if source_entity != person_entity and target_entity != person_entity:
@@ -408,7 +421,10 @@ def map_to_entity(
408
421
  # Fill NaN with 0
409
422
  result[agg_cols] = result[agg_cols].fillna(0)
410
423
 
411
- return MicroDataFrame(result, weights=target_weight)
424
+ result_df = MicroDataFrame(result, weights=target_weight)
425
+ if return_series:
426
+ return result_df["__mapped_value"]
427
+ return result_df
412
428
 
413
429
  raise ValueError(
414
430
  f"Unsupported mapping from {source_entity} to {target_entity}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: policyengine
3
- Version: 3.1.4
3
+ Version: 3.1.5
4
4
  Summary: A package to conduct policy analysis using PolicyEngine tax-benefit models.
5
5
  Author-email: PolicyEngine <hello@policyengine.org>
6
6
  License: GNU AFFERO GENERAL PUBLIC LICENSE
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes