PolicyEngine / policyengine-core

Core microsimulation engine for PolicyEngine models. Forked from OpenFisca-Core.
https://policyengine.github.io/policyengine-core
GNU Affero General Public License v3.0
14 stars 19 forks source link

Raise DivisionByZeroError when calls to microdf result in division by zero #255

Closed anth-volk closed 3 weeks ago

anth-volk commented 3 weeks ago

This is linked to https://github.com/PolicyEngine/policyengine-uk/issues/928. In situations where a sim or microsim attempts to use microdf's MicroSeries class, rank method with an array of weights that equal 0, core should raise an error. This is because the rank method will attempt to divide by the sum of all values within the weights array, be unable to divide, and return an array of nan values.

MaxGhenis commented 3 weeks ago

Should this be in microdf? Since this involves the additional weighting functionality, not just core pandas replication.

anth-volk commented 3 weeks ago

Definitely

anth-volk commented 3 weeks ago

Closing in light of https://github.com/PSLmodels/microdf/issues/233