Skip to content

Fix: NA groups being omitted from plotly plots#1208

Open
Swargambharath987 wants to merge 1 commit intoIGS:develfrom
Swargambharath987:fix/plotly-na-groups-omitted
Open

Fix: NA groups being omitted from plotly plots#1208
Swargambharath987 wants to merge 1 commit intoIGS:develfrom
Swargambharath987:fix/plotly-na-groups-omitted

Conversation

@Swargambharath987
Copy link

Fixes #888

The dataframe passed to plotly had NaN values in categorical obs columns, causing NA groups to be silently dropped and triggering a KeyError in plotly express. @adkinsrs
had attempted a simple fillna but left it commented out due to the error: 'Cannot setitem on a Categorical with a new category, set the categories first'.

Fixed by iterating over categorical columns and conditionally adding 'NA' as a category before filling, with a guard to avoid adding it if it already exists. Object
columns are handled with a plain fillna.

@jorvis jorvis requested a review from adkinsrs March 1, 2026 06:09
@jorvis
Copy link
Member

jorvis commented Mar 1, 2026

Glad to see the contributions! Take care though, it seems you are adding commits which don't belong to this PR.

@Swargambharath987 Swargambharath987 force-pushed the fix/plotly-na-groups-omitted branch from ec85423 to 7aa0fdf Compare March 2, 2026 06:36
@Swargambharath987
Copy link
Author

Thanks for catching that @jorvis, cleaned that up for #1207 as well.

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.

"NA" groups are omitted from plotly plots

2 participants