From b507da1032a81b767003f831a404c5c392daa9de Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sun, 25 Jan 2026 08:19:08 -0500 Subject: [PATCH 1/4] Bump policyengine-core to 3.23.5 for pandas 3.0 compatibility Co-Authored-By: Claude Opus 4.5 --- changelog_entry.yaml | 7 ++----- pyproject.toml | 6 +++--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index 8716d2e7..58659269 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -1,7 +1,4 @@ - bump: patch changes: - added: - - Poverty output type for single-simulation analysis - - Inequality output type with Gini coefficient - fixed: - - Labels now correctly apply to breakdown parameters + changed: + - Bumped policyengine-core minimum version to 3.23.5 for pandas 3.0 compatibility diff --git a/pyproject.toml b/pyproject.toml index c50583e8..c5922574 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,11 +23,11 @@ dependencies = [ [project.optional-dependencies] uk = [ - "policyengine_core>=3.10", + "policyengine_core>=3.23.5", "policyengine-uk>=2.51.0", ] us = [ - "policyengine_core>=3.10", + "policyengine_core>=3.23.5", "policyengine-us>=1.213.1", ] dev = [ @@ -41,7 +41,7 @@ dev = [ "build", "pytest-asyncio>=0.26.0", "ruff>=0.5.0", - "policyengine_core>=3.10", + "policyengine_core>=3.23.5", "policyengine-uk>=2.51.0", "policyengine-us>=1.213.1", ] From 485f100ef65701d1ed230b083167a7ce69ba31c1 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sun, 25 Jan 2026 08:32:05 -0500 Subject: [PATCH 2/4] Add test for pandas 3.0 enum encoding compatibility Adds TDD test to verify that policyengine-core's Enum.encode works correctly with pandas Series, which is required for pandas 3.0 support. Co-Authored-By: Claude Opus 4.5 --- tests/test_pandas3_compatibility.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/test_pandas3_compatibility.py diff --git a/tests/test_pandas3_compatibility.py b/tests/test_pandas3_compatibility.py new file mode 100644 index 00000000..8c013218 --- /dev/null +++ b/tests/test_pandas3_compatibility.py @@ -0,0 +1,19 @@ +"""Test pandas 3.0 compatibility with enum encoding.""" +import pandas as pd +from policyengine_core.enums import Enum + + +class SampleEnum(Enum): + VALUE_A = "value_a" + VALUE_B = "value_b" + + +def test_enum_encode_with_pandas_series(): + """Test that Enum.encode works with pandas Series.""" + enum_items = [SampleEnum.VALUE_A, SampleEnum.VALUE_B, SampleEnum.VALUE_A] + series = pd.Series(enum_items) + + encoded = SampleEnum.encode(series) + + assert len(encoded) == 3 + assert list(encoded) == [0, 1, 0] From 3e71f4acca2d83310a1db3a377c29a154d6c50a6 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sun, 25 Jan 2026 09:14:07 -0500 Subject: [PATCH 3/4] Bump microdf>=1.2.1 and policyengine-core>=3.23.6 for pandas 3.0 compat - microdf 1.2.1 fixes 'Series' object has no attribute 'set_weights' error - policyengine-core 3.23.6 fixes StringArray hashability for parameter lookups Co-Authored-By: Claude Opus 4.5 --- pyproject.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c5922574..d96edda2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ requires-python = ">=3.13" dependencies = [ "pydantic>=2.0.0", "pandas>=2.0.0", - "microdf_python", + "microdf_python>=1.2.1", "plotly>=5.0.0", "requests>=2.31.0", "psutil>=5.9.0", @@ -23,11 +23,11 @@ dependencies = [ [project.optional-dependencies] uk = [ - "policyengine_core>=3.23.5", + "policyengine_core>=3.23.6", "policyengine-uk>=2.51.0", ] us = [ - "policyengine_core>=3.23.5", + "policyengine_core>=3.23.6", "policyengine-us>=1.213.1", ] dev = [ @@ -41,7 +41,7 @@ dev = [ "build", "pytest-asyncio>=0.26.0", "ruff>=0.5.0", - "policyengine_core>=3.23.5", + "policyengine_core>=3.23.6", "policyengine-uk>=2.51.0", "policyengine-us>=1.213.1", ] From 8dafbc341dc96434fa7c7be3788cb2e49aefdd53 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sun, 25 Jan 2026 09:17:00 -0500 Subject: [PATCH 4/4] Fix trailing whitespace in test file --- tests/test_pandas3_compatibility.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_pandas3_compatibility.py b/tests/test_pandas3_compatibility.py index 8c013218..93fecd4d 100644 --- a/tests/test_pandas3_compatibility.py +++ b/tests/test_pandas3_compatibility.py @@ -12,8 +12,8 @@ def test_enum_encode_with_pandas_series(): """Test that Enum.encode works with pandas Series.""" enum_items = [SampleEnum.VALUE_A, SampleEnum.VALUE_B, SampleEnum.VALUE_A] series = pd.Series(enum_items) - + encoded = SampleEnum.encode(series) - + assert len(encoded) == 3 assert list(encoded) == [0, 1, 0]