Sibling of #161 (Uganda cluster_features) and #162 (cross-country stray i).
Feature('sample') is structurally much healthier — no duplicate indices, no stray
i column — but it surfaces a separate set of issues worth tracking.
Summary
489,406 rows, 32 countries, clean (country, i, t) MultiIndex, no duplicates.
Issues
1. Stray int_t column (severity: medium)
int_t (dtype float64, 467,703 / 489,406 non-null) leaks into the sample output
despite belonging in interview_date. Almost certainly a wave-level data_info.yml
declaring int_t under a sample: stanza when it should be under
interview_date:. Grep across all countries to find the offenders.
2. China weight entirely null
China's sample DataFrame has 787 rows, all 787 with weight = <NA>. The
optional: true override applied in the v0.7.0 release makes this schema-valid,
but the data gap is real and worth a sanity check — is China's sample frame
genuinely unweighted, or did a mapping silently drop the column?
3. Rural spelling inconsistencies (canonical spellings gaps)
Rural 275290
Urban 178609
rural 5790 # lowercase variant — should map to 'Rural'
urban 4090 # lowercase variant — should map to 'Urban'
0 2263 # numeric code — some country has 0 for a category
Semi-urban 1578 # genuine third category
Informal 83 # genuine fourth category
Roughly 10K rows with case variants that the canonical spellings dict in
lsms_library/data_info.yml should catch but doesn't. 0 (2,263 rows) is a
numeric code that needs an explicit mapping: block in whichever country's wave
YAML surfaces it.
Suggested fixes:
- Add
rural, urban (lowercase) to the spellings lists for Rural/Urban in
data_info.yml. Alternatively, apply .str.title() normalization in
_enforce_canonical_spellings.
- Locate the country producing
'0' for Rural and map it.
Semi-urban / Informal are legitimate — should stay in the canonical set
rather than being coerced to Rural/Urban.
4. Azerbaijan weights look like a fallback
Azerbaijan 1995 sample has 2,016 rows but the weight column has only 3
distinct values (min 0.694, max 1.258). That's an extremely uniform
distribution and may indicate a default / fallback weight rather than true
survey weights. Worth verifying against the raw microdata (PP.dta per
the data_info.yml).
5. Resource-handle leak (minor / benign)
lsms_library/country.py:831 appears to load YAML without with context, leaving
file handles unclosed. Not behaviorally broken but flagged by the audit pipeline.
Out of scope
Not a release blocker — v0.7.0 has shipped. Queueing here for a v0.7.1 or
later cleanup pass.
Sibling of #161 (Uganda cluster_features) and #162 (cross-country stray
i).Feature('sample')is structurally much healthier — no duplicate indices, no strayicolumn — but it surfaces a separate set of issues worth tracking.Summary
489,406 rows, 32 countries, clean (country, i, t) MultiIndex, no duplicates.
Issues
1. Stray
int_tcolumn (severity: medium)int_t(dtypefloat64, 467,703 / 489,406 non-null) leaks into thesampleoutputdespite belonging in
interview_date. Almost certainly a wave-leveldata_info.ymldeclaring
int_tunder asample:stanza when it should be underinterview_date:. Grep across all countries to find the offenders.2. China weight entirely null
China's
sampleDataFrame has 787 rows, all 787 withweight = <NA>. Theoptional: trueoverride applied in the v0.7.0 release makes this schema-valid,but the data gap is real and worth a sanity check — is China's sample frame
genuinely unweighted, or did a mapping silently drop the column?
3. Rural spelling inconsistencies (canonical
spellingsgaps)Roughly 10K rows with case variants that the canonical
spellingsdict inlsms_library/data_info.ymlshould catch but doesn't.0(2,263 rows) is anumeric code that needs an explicit
mapping:block in whichever country's waveYAML surfaces it.
Suggested fixes:
rural,urban(lowercase) to thespellingslists forRural/Urbanindata_info.yml. Alternatively, apply.str.title()normalization in_enforce_canonical_spellings.'0'for Rural and map it.Semi-urban/Informalare legitimate — should stay in the canonical setrather than being coerced to Rural/Urban.
4. Azerbaijan weights look like a fallback
Azerbaijan 1995 sample has 2,016 rows but the
weightcolumn has only 3distinct values (min 0.694, max 1.258). That's an extremely uniform
distribution and may indicate a default / fallback weight rather than true
survey weights. Worth verifying against the raw microdata (
PP.dtaperthe data_info.yml).
5. Resource-handle leak (minor / benign)
lsms_library/country.py:831appears to load YAML withoutwithcontext, leavingfile handles unclosed. Not behaviorally broken but flagged by the audit pipeline.
Out of scope
Not a release blocker —
v0.7.0has shipped. Queueing here for a v0.7.1 orlater cleanup pass.