Skip to content

fix(docs): handle NaN metadata cells in macro table generator#1117

Open
bkowshik wants to merge 2 commits into
NeuroTechX:developfrom
bkowshik:fix/macro-table-nan-cells
Open

fix(docs): handle NaN metadata cells in macro table generator#1117
bkowshik wants to merge 2 commits into
NeuroTechX:developfrom
bkowshik:fix/macro-table-nan-cells

Conversation

@bkowshik

@bkowshik bkowshik commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What

Fix a crash in scripts/generate_macro_table.py that breaks make html whenever a dataset has a missing (NaN) value in an optional metadata column (country, DOI, etc.).

Why

pandas stores missing cells as float NaN, which is truthy. The string formatters in _format_cell guard with if not value: — that guard lets NaN through, and the formatter then runs str/len operations on a float and crashes:

TypeError: object of type 'float' has no len()             # country_flag
AttributeError: 'float' object has no attribute 'replace'  # _doi_link

This surfaced after the metadata catalog (#868) added many optional columns that are empty for most datasets.

Fix

Normalize NaN to "" once at the top of _format_cell, before dispatching to any formatter. This centrally covers every string formatter (country, DOI, data URL, health) instead of patching each one individually.

Verification

make html-noplot builds green (exit 0); the macro table generates for all 158 datasets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant