fix(docs): handle NaN metadata cells in macro table generator#1117
Open
bkowshik wants to merge 2 commits into
Open
fix(docs): handle NaN metadata cells in macro table generator#1117bkowshik wants to merge 2 commits into
bkowshik wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fix a crash in
scripts/generate_macro_table.pythat breaksmake htmlwhenever 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_cellguard withif not value:— that guard letsNaNthrough, and the formatter then runsstr/lenoperations on a float and crashes:This surfaced after the metadata catalog (#868) added many optional columns that are empty for most datasets.
Fix
Normalize
NaNto""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-noplotbuilds green (exit 0); the macro table generates for all 158 datasets.