PolicyEngine / PolicyEngine/policyengine-us

RuntimeWarning: invalid value encountered in divide — QBI / labor-supply variables (84 occurrences in policyengine.py test suite)

Open
#8,216 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
163
Forks
213
Avg merge
3d 3h
Merged PRs (30d)
96

Description

Running `pytest tests --no-cov` on `PolicyEngine/policyengine.py@joss-paper` produces 429 passes and 84 `RuntimeWarning: invalid value encountered in divide` warnings. All originate from `policyengine_us`, concentrated in QBI (qualified business income) and labor-supply variables.

These are not test failures, but they create significant noise in the test output and likely indicate division-by-zero in formulas that should be guarded with `np.where` / `np.divide(where=...)`.

Related but more specific than:
- #745 (general divide-by-zero in test suite)
- #4891 (rank-calc warning)
- #6356 (mask → `np.divide` refactor proposal)

Reproduction:
```
git clone https://github.com/PolicyEngine/policyengine.py
cd policyengine.py && git checkout joss-paper
pip install -e .
pytest tests --no-cov -W error::RuntimeWarning # to surface them
```

Reported in the discussion on PolicyEngine/policyengine.py#264.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.