fix: convert StringArray to numpy array in uprate_rent #1489
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
uprate_rentwhenregion.values.astype(str)returns a pandasStringArrayinstead of a numpy arrayParameterNodeAtInstant.__getitem__expects anumpy.ndarrayfor vectorial lookup, but pandas StringArray is not hashableProblem
When running microsimulations, the following error occurs:
This happens in
economic_assumptions.pyline 164-165 whereregion.values.astype(str)returns a pandas StringArray which cannot be used as a key in the parameter lookup.CI Test Failures (Unrelated to this PR)
The CI test failures are NOT caused by this PR. They are due to a dependency version conflict that occurred after the last successful main branch CI run.
Evidence:
Root cause:
The CI workflow runs
uv pip install policyengine --systemwhich now pulls in:pandas==3.0.0(newly released)microdf-python==1.1.2This combination is broken -
microdf 1.1.2is incompatible withpandas 3.0.0: