policyengine-core 3.2.0__tar.gz → 3.4.0__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 (199) hide show
  1. {policyengine_core-3.2.0/policyengine_core.egg-info → policyengine_core-3.4.0}/PKG-INFO +1 -3
  2. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/charts/bar.py +1 -1
  3. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/data/dataset.py +5 -4
  4. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/enums/enum.py +3 -2
  5. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/parameters/parameter.py +9 -0
  6. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/populations/group_population.py +16 -0
  7. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/populations/population.py +3 -0
  8. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/reforms/reform.py +2 -0
  9. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/simulations/microsimulation.py +1 -1
  10. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/simulations/simulation.py +71 -20
  11. {policyengine_core-3.2.0 → policyengine_core-3.4.0/policyengine_core.egg-info}/PKG-INFO +1 -3
  12. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core.egg-info/requires.txt +0 -2
  13. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/setup.py +1 -3
  14. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/LICENSE +0 -0
  15. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/MANIFEST.in +0 -0
  16. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/README.md +0 -0
  17. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/__init__.py +0 -0
  18. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/charts/__init__.py +0 -0
  19. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/charts/api.py +0 -0
  20. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/charts/formatting.py +0 -0
  21. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/commons/__init__.py +0 -0
  22. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/commons/formulas.py +0 -0
  23. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/commons/misc.py +0 -0
  24. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/commons/rates.py +0 -0
  25. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/__init__.py +0 -0
  26. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/constants.py +0 -0
  27. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/data/__init__.py +0 -0
  28. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/data/datasets/__init__.py +0 -0
  29. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/data/datasets/country_template_dataset.py +0 -0
  30. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/entities.py +0 -0
  31. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/modelled_policies.yaml +0 -0
  32. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/parameters/benefits/basic_income.yaml +0 -0
  33. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/parameters/benefits/housing_allowance.yaml +0 -0
  34. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/parameters/benefits/index.yaml +0 -0
  35. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/parameters/benefits/parenting_allowance/amount.yaml +0 -0
  36. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/parameters/benefits/parenting_allowance/income_threshold.yaml +0 -0
  37. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/parameters/general/age_of_majority.yaml +0 -0
  38. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/parameters/general/age_of_retirement.yaml +0 -0
  39. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/parameters/taxes/housing_tax.yaml +0 -0
  40. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/parameters/taxes/income_tax_rate.yaml +0 -0
  41. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/parameters/taxes/social_security_contribution.yaml +0 -0
  42. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/reforms/__init__.py +0 -0
  43. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/reforms/add_dynamic_variable.py +0 -0
  44. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/reforms/add_new_tax.py +0 -0
  45. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/reforms/flat_social_security_contribution.py +0 -0
  46. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/reforms/modify_social_security_taxation.py +0 -0
  47. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/reforms/removal_basic_income.py +0 -0
  48. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/situation_examples/__init__.py +0 -0
  49. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/situation_examples/couple.json +0 -0
  50. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/situation_examples/housing.json +0 -0
  51. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/situation_examples/single.json +0 -0
  52. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/tests/age.yaml +0 -0
  53. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/tests/basic_income.yaml +0 -0
  54. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/tests/disposable_income.yaml +0 -0
  55. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/tests/housing_allowance.yaml +0 -0
  56. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/tests/housing_tax.yaml +0 -0
  57. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/tests/income_tax.yaml +0 -0
  58. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/tests/reforms/add_dynamic_variable.yaml +0 -0
  59. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/tests/reforms/add_new_tax.yaml +0 -0
  60. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/tests/reforms/modify_social_security_taxation.yaml +0 -0
  61. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/tests/situations/income_tax.yaml +0 -0
  62. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/tests/situations/parenting_allowance.yaml +0 -0
  63. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/tests/social_security_contribution.yaml +0 -0
  64. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/tests/test_microsimulation.py +0 -0
  65. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/variables/__init__.py +0 -0
  66. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/variables/benefits.py +0 -0
  67. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/variables/demographics.py +0 -0
  68. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/variables/housing.py +0 -0
  69. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/variables/ids.py +0 -0
  70. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/variables/income.py +0 -0
  71. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/variables/stats.py +0 -0
  72. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/country_template/variables/taxes.py +0 -0
  73. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/data/__init__.py +0 -0
  74. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/data_storage/__init__.py +0 -0
  75. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/data_storage/in_memory_storage.py +0 -0
  76. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/data_storage/on_disk_storage.py +0 -0
  77. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/data_structures/__init__.py +0 -0
  78. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/data_structures/parameter_metadata.py +0 -0
  79. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/data_structures/parameter_node_metadata.py +0 -0
  80. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/data_structures/reference.py +0 -0
  81. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/data_structures/unit.py +0 -0
  82. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/entities/__init__.py +0 -0
  83. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/entities/entity.py +0 -0
  84. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/entities/group_entity.py +0 -0
  85. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/entities/helpers.py +0 -0
  86. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/entities/role.py +0 -0
  87. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/enums/__init__.py +0 -0
  88. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/enums/config.py +0 -0
  89. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/enums/enum_array.py +0 -0
  90. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/errors/__init__.py +0 -0
  91. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/errors/cycle_error.py +0 -0
  92. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/errors/empty_argument_error.py +0 -0
  93. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/errors/nan_creation_error.py +0 -0
  94. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/errors/parameter_not_found_error.py +0 -0
  95. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/errors/parameter_parsing_error.py +0 -0
  96. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/errors/period_mismatch_error.py +0 -0
  97. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/errors/situation_parsing_error.py +0 -0
  98. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/errors/spiral_error.py +0 -0
  99. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/errors/variable_name_conflict_error.py +0 -0
  100. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/errors/variable_not_found_error.py +0 -0
  101. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/experimental/__init__.py +0 -0
  102. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/experimental/memory_config.py +0 -0
  103. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/extension_template/__init__.py +0 -0
  104. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/extension_template/local_benefit.py +0 -0
  105. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/extension_template/parameters/local_town/child_allowance/amount.yaml +0 -0
  106. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/extension_template/parameters/local_town/child_allowance/index.yaml +0 -0
  107. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/extension_template/parameters/local_town/index.yaml +0 -0
  108. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/extension_template/tests/local_benefit.yaml +0 -0
  109. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/holders/__init__.py +0 -0
  110. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/holders/helpers.py +0 -0
  111. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/holders/holder.py +0 -0
  112. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/model_api.py +0 -0
  113. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/parameters/__init__.py +0 -0
  114. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/parameters/at_instant_like.py +0 -0
  115. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/parameters/config.py +0 -0
  116. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/parameters/helpers.py +0 -0
  117. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/parameters/operations/__init__.py +0 -0
  118. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/parameters/operations/get_parameter.py +0 -0
  119. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/parameters/operations/homogenize_parameters.py +0 -0
  120. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/parameters/operations/interpolate_parameters.py +0 -0
  121. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/parameters/operations/propagate_parameter_metadata.py +0 -0
  122. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/parameters/operations/uprate_parameters.py +0 -0
  123. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/parameters/parameter_at_instant.py +0 -0
  124. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/parameters/parameter_node.py +0 -0
  125. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/parameters/parameter_node_at_instant.py +0 -0
  126. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/parameters/parameter_scale.py +0 -0
  127. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/parameters/parameter_scale_bracket.py +0 -0
  128. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/parameters/vectorial_parameter_node_at_instant.py +0 -0
  129. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/periods/__init__.py +0 -0
  130. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/periods/config.py +0 -0
  131. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/periods/helpers.py +0 -0
  132. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/periods/instant_.py +0 -0
  133. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/periods/period_.py +0 -0
  134. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/populations/__init__.py +0 -0
  135. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/populations/config.py +0 -0
  136. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/projectors/__init__.py +0 -0
  137. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/projectors/entity_to_person_projector.py +0 -0
  138. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/projectors/first_person_to_entity_projector.py +0 -0
  139. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/projectors/helpers.py +0 -0
  140. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/projectors/projector.py +0 -0
  141. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/projectors/unique_role_to_entity_projector.py +0 -0
  142. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/reforms/__init__.py +0 -0
  143. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/scripts/__init__.py +0 -0
  144. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/scripts/assets/__init__.py +0 -0
  145. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/scripts/assets/index.html +0 -0
  146. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/scripts/policyengine_command.py +0 -0
  147. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/scripts/run_data.py +0 -0
  148. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/scripts/run_test.py +0 -0
  149. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/scripts/simulation_generator.py +0 -0
  150. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/simulations/__init__.py +0 -0
  151. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/simulations/helpers.py +0 -0
  152. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/simulations/individual_sim.py +0 -0
  153. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/simulations/simulation_builder.py +0 -0
  154. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/taxbenefitsystems/__init__.py +0 -0
  155. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/taxbenefitsystems/tax_benefit_system.py +0 -0
  156. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/taxscales/__init__.py +0 -0
  157. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/taxscales/abstract_rate_tax_scale.py +0 -0
  158. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/taxscales/abstract_tax_scale.py +0 -0
  159. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/taxscales/amount_tax_scale_like.py +0 -0
  160. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/taxscales/helpers.py +0 -0
  161. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/taxscales/linear_average_rate_tax_scale.py +0 -0
  162. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/taxscales/marginal_amount_tax_scale.py +0 -0
  163. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/taxscales/marginal_rate_tax_scale.py +0 -0
  164. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/taxscales/rate_tax_scale_like.py +0 -0
  165. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/taxscales/single_amount_tax_scale.py +0 -0
  166. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/taxscales/tax_scale_like.py +0 -0
  167. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/tools/__init__.py +0 -0
  168. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/tools/simulation_dumper.py +0 -0
  169. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/tools/test_from_situation.py +0 -0
  170. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/tools/test_runner.py +0 -0
  171. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/tracers/__init__.py +0 -0
  172. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/tracers/computation_log.py +0 -0
  173. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/tracers/flat_trace.py +0 -0
  174. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/tracers/full_tracer.py +0 -0
  175. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/tracers/performance_log.py +0 -0
  176. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/tracers/simple_tracer.py +0 -0
  177. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/tracers/trace_node.py +0 -0
  178. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/tracers/tracing_parameter_node_at_instant.py +0 -0
  179. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/tracers/variable_graph.py +0 -0
  180. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/types/__init__.py +0 -0
  181. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/types/data_types/__init__.py +0 -0
  182. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/types/data_types/arrays.py +0 -0
  183. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/variables/__init__.py +0 -0
  184. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/variables/config.py +0 -0
  185. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/variables/defined_for.py +0 -0
  186. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/variables/helpers.py +0 -0
  187. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/variables/typing.py +0 -0
  188. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/variables/variable.py +0 -0
  189. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/warnings/__init__.py +0 -0
  190. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/warnings/libyaml_warning.py +0 -0
  191. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/warnings/memory_config_warning.py +0 -0
  192. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/warnings/tempfile_warning.py +0 -0
  193. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/weighting/__init__.py +0 -0
  194. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core/weighting/microdf.py +0 -0
  195. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core.egg-info/SOURCES.txt +0 -0
  196. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core.egg-info/dependency_links.txt +0 -0
  197. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core.egg-info/entry_points.txt +0 -0
  198. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/policyengine_core.egg-info/top_level.txt +0 -0
  199. {policyengine_core-3.2.0 → policyengine_core-3.4.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: policyengine-core
3
- Version: 3.2.0
3
+ Version: 3.4.0
4
4
  Summary: Core microsimulation engine enabling country-specific policy models.
5
5
  Home-page: https://github.com/policyengine/policyengine-core
6
6
  Author: PolicyEngine
@@ -32,8 +32,6 @@ Requires-Dist: nptyping<2
32
32
  Requires-Dist: psutil<6
33
33
  Requires-Dist: wheel<1
34
34
  Requires-Dist: h5py<4,>=3
35
- Requires-Dist: microdf_python<1,>=0.3.0
36
- Requires-Dist: tqdm<5,>=4.46.0
37
35
  Requires-Dist: requests<3,>=2.27.1
38
36
  Requires-Dist: pandas>=1
39
37
  Requires-Dist: plotly<6,>=5.6.0
@@ -1,7 +1,7 @@
1
1
  import pandas as pd
2
2
  from .formatting import *
3
3
  import plotly.express as px
4
- from microdf import MicroSeries
4
+ from policyengine_core.weighting import MicroSeries
5
5
  from typing import Callable
6
6
  import numpy as np
7
7
 
@@ -186,6 +186,8 @@ class Dataset:
186
186
  raise ValueError(
187
187
  f"Could not save {variable} to {file}. The value is {value}."
188
188
  )
189
+ elif self.data_format == Dataset.FLAT_FILE:
190
+ values.to_csv(file, index=False)
189
191
 
190
192
  def load_dataset(
191
193
  self,
@@ -371,17 +373,16 @@ class Dataset:
371
373
  Returns:
372
374
  Dataset: The dataset.
373
375
  """
374
- file_path = Path(file_path)
375
376
  dataset = type(
376
377
  "Dataset",
377
378
  (Dataset,),
378
379
  {
379
- "name": file_path.stem,
380
- "label": file_path.stem,
380
+ "name": "dataframe",
381
+ "label": "DataFrame",
381
382
  "data_format": Dataset.FLAT_FILE,
382
383
  "file_path": "dataframe",
383
384
  "time_period": time_period,
384
- "load": lambda: dataframe,
385
+ "load": lambda self: dataframe,
385
386
  },
386
387
  )()
387
388
 
@@ -53,10 +53,11 @@ class Enum(enum.Enum):
53
53
  # Confusingly, Numpy uses "S" to refer to byte-string arrays
54
54
  # and "U" to refer to Unicode-string arrays, which are also
55
55
  # referred to as the "str" type
56
- if array.dtype.kind == "S":
56
+ if isinstance(array[0], Enum):
57
+ array = np.array([item.name for item in array])
58
+ if array.dtype.kind == "S" or array.dtype == object:
57
59
  # Convert boolean array to string array
58
60
  array = array.astype(str)
59
-
60
61
  if isinstance(array, np.ndarray) and array.dtype.kind in {"U", "S"}:
61
62
  # String array
62
63
  indices = np.select(
@@ -224,3 +224,12 @@ class Parameter(AtInstantLike):
224
224
  if value_at_instant.instant_str <= instant:
225
225
  return value_at_instant.value
226
226
  return None
227
+
228
+ def relative_change(self, start_instant, end_instant):
229
+ start_instant = str(start_instant)
230
+ end_instant = str(end_instant)
231
+ end_value = self._get_at_instant(end_instant)
232
+ start_value = self._get_at_instant(start_instant)
233
+ if end_value is None or start_value is None:
234
+ return None
235
+ return end_value / start_value - 1
@@ -7,6 +7,8 @@ from policyengine_core import projectors
7
7
  from policyengine_core.entities import Entity, Role
8
8
  from policyengine_core.enums import EnumArray
9
9
  from policyengine_core.populations.population import Population
10
+ from policyengine_core.periods.period_ import Period
11
+ from typing import Optional, Container
10
12
 
11
13
  if TYPE_CHECKING:
12
14
  from policyengine_core.simulations import Simulation
@@ -21,6 +23,20 @@ class GroupPopulation(Population):
21
23
  self._members_position: ArrayLike = None
22
24
  self._ordered_members_map = None
23
25
 
26
+ def __call__(
27
+ self,
28
+ variable_name: str,
29
+ period: Period = None,
30
+ options: Optional[Container[str]] = None,
31
+ ):
32
+ variable = self.simulation.tax_benefit_system.variables.get(
33
+ variable_name
34
+ )
35
+ if variable.entity.is_person:
36
+ return self.sum(self.members(variable_name, period, options))
37
+ else:
38
+ return super().__call__(variable_name, period, options)
39
+
24
40
  def clone(
25
41
  self, simulation: "Simulation", members: Population
26
42
  ) -> "GroupPopulation":
@@ -34,6 +34,9 @@ class Population:
34
34
  result.ids = self.ids
35
35
  return result
36
36
 
37
+ def has_any_input(self, variable_name: str) -> bool:
38
+ return len(self.get_holder(variable_name).get_known_periods()) > 0
39
+
37
40
  def empty_array(self) -> numpy.ndarray:
38
41
  return numpy.zeros(self.count)
39
42
 
@@ -148,6 +148,8 @@ class Reform(TaxBenefitSystem):
148
148
  for period, value in period_values.items():
149
149
  if "." in period:
150
150
  start, stop = period.split(".")
151
+ start = instant_(start)
152
+ stop = instant_(stop)
151
153
  parameter.update(
152
154
  start=start, stop=stop, value=value
153
155
  )
@@ -1,6 +1,6 @@
1
1
  from typing import Dict, Type
2
2
 
3
- from microdf import MicroDataFrame, MicroSeries
3
+ from policyengine_core.weighting import MicroDataFrame, MicroSeries
4
4
  import numpy as np
5
5
  from policyengine_core.data.dataset import Dataset
6
6
  from policyengine_core.periods import Period
@@ -76,6 +76,9 @@ class Simulation:
76
76
  macro_cache_write: bool = True
77
77
  """Whether to write to the macro cache."""
78
78
 
79
+ start_instant: str = None
80
+ """The earliest data input instant of the simulation."""
81
+
79
82
  def __init__(
80
83
  self,
81
84
  tax_benefit_system: "TaxBenefitSystem" = None,
@@ -155,6 +158,10 @@ class Simulation:
155
158
  )
156
159
  if isinstance(dataset, type):
157
160
  self.dataset: Dataset = dataset(require=True)
161
+ elif isinstance(dataset, pd.DataFrame):
162
+ self.dataset = Dataset.from_dataframe(
163
+ dataset, self.default_input_period
164
+ )
158
165
  else:
159
166
  self.dataset = dataset
160
167
  self.build_from_dataset()
@@ -242,23 +249,33 @@ class Simulation:
242
249
  + "Make sure you have downloaded or built it using the `policyengine-core data` command."
243
250
  ) from e
244
251
 
252
+ if self.dataset.data_format == Dataset.FLAT_FILE:
253
+ data_copy = {col: data[col].values for col in data.copy().columns}
254
+ data = {col: data[col].values for col in data.columns}
255
+
245
256
  person_entity = self.tax_benefit_system.person_entity
246
257
  entity_id_field = f"{person_entity.key}_id"
258
+
259
+ def get_eternity_array(name):
260
+ if self.dataset.data_format == Dataset.FLAT_FILE:
261
+ # Look for any column with variablename__timeperiod
262
+ for col in data:
263
+ if col.split("__")[0] == name:
264
+ return data[col]
265
+ elif self.dataset.data_format == Dataset.TIME_PERIOD_ARRAYS:
266
+ return data[name][list(data[name].keys())[0]]
267
+ return data[name]
268
+
247
269
  if self.dataset.data_format != Dataset.FLAT_FILE:
248
270
  assert (
249
271
  entity_id_field in data
250
272
  ), f"Missing {entity_id_field} column in the dataset. Each person entity must have an ID array defined for ETERNITY."
251
273
  elif entity_id_field not in data:
252
- data[entity_id_field] = np.arange(len(data))
253
- if self.dataset.data_format != Dataset.FLAT_FILE:
254
- get_eternity_array = lambda ds: (
255
- ds[list(ds.keys())[0]]
256
- if self.dataset.data_format == Dataset.TIME_PERIOD_ARRAYS
257
- else ds
274
+ data[entity_id_field] = np.arange(
275
+ len(get_eternity_array("person_id"))
258
276
  )
259
- else:
260
- get_eternity_array = lambda ds: ds
261
- entity_ids = get_eternity_array(data[entity_id_field])
277
+
278
+ entity_ids = get_eternity_array(entity_id_field)
262
279
  builder.declare_person_entity(person_entity.key, entity_ids)
263
280
 
264
281
  for group_entity in self.tax_benefit_system.group_entities:
@@ -267,10 +284,18 @@ class Simulation:
267
284
  assert (
268
285
  entity_id_field in data
269
286
  ), f"Missing {entity_id_field} column in the dataset. Each group entity must have an ID array defined for ETERNITY."
287
+ entity_ids = get_eternity_array(entity_id_field)
270
288
  elif entity_id_field not in data:
271
- data[entity_id_field] = np.arange(len(data))
289
+ entity_id_field_values = get_eternity_array(
290
+ f"person_{group_entity.key}_id"
291
+ )
292
+ if entity_id_field_values is not None:
293
+ entity_ids = np.arange(
294
+ len(np.unique(entity_id_field_values))
295
+ )
296
+ else:
297
+ entity_ids = np.arange(len(data[list(data.keys())[0]]))
272
298
 
273
- entity_ids = get_eternity_array(data[entity_id_field])
274
299
  builder.declare_entity(group_entity.key, entity_ids)
275
300
 
276
301
  person_membership_id_field = (
@@ -283,14 +308,14 @@ class Simulation:
283
308
  elif person_membership_id_field not in data:
284
309
  data[person_membership_id_field] = np.arange(len(data))
285
310
  person_membership_ids = get_eternity_array(
286
- data[person_membership_id_field]
311
+ person_membership_id_field
287
312
  )
288
313
 
289
314
  person_role_field = f"{person_entity.key}_{group_entity.key}_role"
290
315
  if person_role_field in data:
291
- person_roles = get_eternity_array(data[person_role_field])
316
+ person_roles = get_eternity_array(person_role_field)
292
317
  elif "role" in data:
293
- person_roles = get_eternity_array(data["role"])
318
+ person_roles = get_eternity_array("role")
294
319
  elif self.default_role is not None:
295
320
  person_roles = np.full(len(entity_ids), self.default_role)
296
321
  else:
@@ -305,6 +330,10 @@ class Simulation:
305
330
 
306
331
  self.build_from_populations(builder.populations)
307
332
 
333
+ if self.dataset.data_format == Dataset.FLAT_FILE:
334
+ # Ensure we're back to all person-level data.
335
+ data = data_copy
336
+
308
337
  if self.dataset.data_format != Dataset.FLAT_FILE:
309
338
  for variable in data:
310
339
  if variable in self.tax_benefit_system.variables:
@@ -333,9 +362,6 @@ class Simulation:
333
362
  )
334
363
 
335
364
  if variable_name not in self.tax_benefit_system.variables:
336
- logging.warn(
337
- f"Variable {variable_name} not found. Skipping."
338
- )
339
365
  continue
340
366
 
341
367
  variable_meta = self.tax_benefit_system.get_variable(
@@ -353,9 +379,11 @@ class Simulation:
353
379
  else:
354
380
  entity_level_data = data[variable]
355
381
 
356
- self.set_input(variable, time_period, entity_level_data)
382
+ self.set_input(variable_name, time_period, entity_level_data)
357
383
 
358
- self.default_calculation_period = self.dataset.time_period
384
+ self.default_calculation_period = (
385
+ self.dataset.time_period or self.default_calculation_period
386
+ )
359
387
 
360
388
  self.tax_benefit_system.data_modified = False
361
389
 
@@ -684,6 +712,8 @@ class Simulation:
684
712
  ):
685
713
  # Variables with a calculate-output property specify
686
714
  last_known_period = sorted(known_periods)[-1]
715
+ if last_known_period.start > period.start:
716
+ return holder.default_array()
687
717
  array = holder.get_array(last_known_period)
688
718
  else:
689
719
  array = holder.default_array()
@@ -1139,10 +1169,12 @@ class Simulation:
1139
1169
 
1140
1170
  If a ``set_input`` property has been set for the variable, this method may accept inputs for periods not matching the ``definition_period`` of the variable. To read more about this, check the `documentation <https://openfisca.org/doc/coding-the-legislation/35_periods.html#automatically-process-variable-inputs-defined-for-periods-not-matching-the-definitionperiod>`_.
1141
1171
  """
1172
+ period = periods.period(period)
1173
+ if self.start_instant is None or self.start_instant > period.start:
1174
+ self.start_instant = period.start
1142
1175
  variable = self.tax_benefit_system.get_variable(
1143
1176
  variable_name, check_existence=True
1144
1177
  )
1145
- period = periods.period(period)
1146
1178
  if (variable.end is not None) and (period.start.date > variable.end):
1147
1179
  return
1148
1180
  self.get_holder(variable_name).set_input(
@@ -1438,6 +1470,25 @@ class Simulation:
1438
1470
  with h5py.File(cache_file_path, "w") as f:
1439
1471
  f.create_dataset("values", data=value)
1440
1472
 
1473
+ def to_input_dataframe(
1474
+ self,
1475
+ ) -> pd.DataFrame:
1476
+ """Exports a DataFrame which can be loaded back to a new Simulation to reproduce the same results.
1477
+
1478
+ Returns:
1479
+ pd.DataFrame: The DataFrame containing the input values.
1480
+ """
1481
+
1482
+ df = pd.DataFrame()
1483
+
1484
+ for variable in self.tax_benefit_system.variables:
1485
+ for period in self.get_holder(variable).get_known_periods():
1486
+ values = self.calculate(variable, period, map_to="person")
1487
+ if values is not None:
1488
+ df[f"{variable}__{period}"] = values
1489
+
1490
+ return df
1491
+
1441
1492
 
1442
1493
  class NpEncoder(json.JSONEncoder):
1443
1494
  def default(self, obj):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: policyengine-core
3
- Version: 3.2.0
3
+ Version: 3.4.0
4
4
  Summary: Core microsimulation engine enabling country-specific policy models.
5
5
  Home-page: https://github.com/policyengine/policyengine-core
6
6
  Author: PolicyEngine
@@ -32,8 +32,6 @@ Requires-Dist: nptyping<2
32
32
  Requires-Dist: psutil<6
33
33
  Requires-Dist: wheel<1
34
34
  Requires-Dist: h5py<4,>=3
35
- Requires-Dist: microdf_python<1,>=0.3.0
36
- Requires-Dist: tqdm<5,>=4.46.0
37
35
  Requires-Dist: requests<3,>=2.27.1
38
36
  Requires-Dist: pandas>=1
39
37
  Requires-Dist: plotly<6,>=5.6.0
@@ -11,8 +11,6 @@ nptyping<2
11
11
  psutil<6
12
12
  wheel<1
13
13
  h5py<4,>=3
14
- microdf_python<1,>=0.3.0
15
- tqdm<5,>=4.46.0
16
14
  requests<3,>=2.27.1
17
15
  pandas>=1
18
16
  plotly<6,>=5.6.0
@@ -23,8 +23,6 @@ general_requirements = [
23
23
  "psutil<6",
24
24
  "wheel<1",
25
25
  "h5py>=3,<4",
26
- "microdf_python>=0.3.0,<1",
27
- "tqdm>=4.46.0,<5",
28
26
  "requests>=2.27.1,<3",
29
27
  "pandas>=1",
30
28
  "plotly>=5.6.0,<6",
@@ -50,7 +48,7 @@ dev_requirements = [
50
48
 
51
49
  setup(
52
50
  name="policyengine-core",
53
- version="3.2.0",
51
+ version="3.4.0",
54
52
  author="PolicyEngine",
55
53
  author_email="hello@policyengine.org",
56
54
  classifiers=[