Describe the bug
The Age/Sex/Ethnicity module will print RunTimeWarnings related to improper comparisons in Pandas greater than and lesser than operations when run for the year 2025.
To Reproduce
Run the Age/Sex/Ethnicity module for year 2025.
Expected behavior
A clear and concise description of what you expected to happen.
Potential resolution
The issue is related to this code section in the python/ase.py file within the _create_ase() method.
seed_mgras.loc[
(seed_mgras["max"] < seed_mgras["min_age"])
| (seed_mgras["min"] > seed_mgras["max_age"]),
"value",
] = 0
The special MGRAs min/max age do not always exist for each MGRA so the greater/less than comparisons are looking at missing values, safely returning false, but still issuing a RunTimeWarning. The following replacement code block will stop these warnings by checking for missings first.
seed_mgras.loc[
(
seed_mgras["min_age"].notna()
& seed_mgras["max"].lt(seed_mgras["min_age"])
)
| (
seed_mgras["max_age"].notna()
& seed_mgras["min"].gt(seed_mgras["max_age"])
),
"value",
] = 0
Describe the bug
The Age/Sex/Ethnicity module will print RunTimeWarnings related to improper comparisons in Pandas greater than and lesser than operations when run for the year 2025.
To Reproduce
Run the Age/Sex/Ethnicity module for year 2025.
Expected behavior
A clear and concise description of what you expected to happen.
Potential resolution
The issue is related to this code section in the
python/ase.pyfile within the_create_ase()method.The special MGRAs min/max age do not always exist for each MGRA so the greater/less than comparisons are looking at missing values, safely returning false, but still issuing a RunTimeWarning. The following replacement code block will stop these warnings by checking for missings first.