Repository navigation
Fix BoxPlot KeyError when columns is not provided - #562
Merged
Merged
Conversation
_validate_inputs wrapped the default columns=None into [None] before
indexing the dataframe, so the None branch was unreachable and
run_test("validmind.plots.BoxPlot", inputs={"dataset": ds}) raised
KeyError: "None of [Index([None], dtype='object')] are in the [columns]".
This broke any loop over list_tests(tags=["data_quality"]), such as the
validate_application_scorecard notebook.
Default to dataset.feature_columns_numeric like HistogramPlot, ViolinPlot
and CorrelationHeatmap already do, and filter explicit columns against it
instead of indexing the frame directly.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
hannes-vm
approved these changes
Sep 3, 2026
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.
Pull Request Description
What and why?
validmind.plots.BoxPlotraised aKeyErrorwhenever it was run without an explicitcolumnsparameter:_validate_inputswrapped the defaultcolumns=Noneinto[None]and indexed the dataframe with it before theif columns is Nonebranch could run, so that branch was dead code. BecauseBoxPlotis taggeddata_quality, this broke any loop overvm.tests.list_tests(tags=["data_quality"], ...), which is exactly whatnotebooks/use_cases/validation/validate_application_scorecard.ipynbdoes (reported by Hannes on the JupyterHub demo environment; the traceback pointed atBoxPlot._validate_inputs, not at the preprocess/feature-engineering cells).The fix defaults to
dataset.feature_columns_numeric, the same approachHistogramPlot,ViolinPlotandCorrelationHeatmapalready use, and filters explicit columns against that list instead of indexing the frame directly (so a misspelled column is skipped rather than raising).How to test
uv run python -m unittest tests.unit_tests.plots.test_BoxPlot(new; two of the four cases fail onmain).for test in dq:loop invalidate_application_scorecard.ipynb. All 11data_qualitytests, includingvalidmind.plots.BoxPlot, now pass on the preprocessed lending club dataset.What needs special review?
Explicit
columnsare now filtered to numeric feature columns, so passing the target column explicitly no longer plots it. This matches the sibling plot tests.Dependencies, breaking changes, and deployment notes
None.
Release notes
Fixed
validmind.plots.BoxPlotraising aKeyErrorwhen run without thecolumnsparameter, which also broke running alldata_qualitytests in a loop.Checklist
🤖 Generated with Claude Code