Skip to content

fix: preserve MultiIndex bar grouping with explicit y - #1768

Open
senanurcetin wants to merge 2 commits into
holoviz:mainfrom
senanurcetin:fix/1667-preserve-multiindex-bar-grouping
Open

senanurcetin wants to merge 2 commits into
holoviz:mainfrom
senanurcetin:fix/1667-preserve-multiindex-bar-grouping

Conversation

@senanurcetin

Copy link
Copy Markdown

Summary

Fixes #1667.

Fix inconsistent bar grouping when plotting Pandas DataFrames with a two-level MultiIndex.

Previously, df.hvplot.bar() grouped data by both index levels, while df.hvplot.bar(y="value") unexpectedly dropped the second grouping dimension.

Changes

  • Preserve automatic MultiIndex grouping when y is explicitly supplied for bar and barh.
  • Maintain the existing behavior when x or by is explicitly configured.
  • Preserve heatmap behavior.
  • Add regression tests for both bar orientations.

Verification

  • The regression test failed before the fix and passed afterward.
  • 800 tests passed, 6 skipped, 3 xfailed across the relevant hvPlot test suites.
  • Ruff lint and Git diff checks passed.
  • Only two files changed: 16 additions and 2 deletions.

AI Assistance

AI assistance was used for debugging, implementation, and regression testing. The changes were validated locally before submission.

This branch has not been deployed

No deployments
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.

Bar plot not grouped when setting y

1 participant