Skip to content

fix(table): allow freezing pandas index columns#9631

Merged
kirangadhave merged 3 commits into
mainfrom
kg/table-freeze-index-columns
May 21, 2026
Merged

fix(table): allow freezing pandas index columns#9631
kirangadhave merged 3 commits into
mainfrom
kg/table-freeze-index-columns

Conversation

@kirangadhave
Copy link
Copy Markdown
Member

@kirangadhave kirangadhave commented May 20, 2026

Summary

mo.ui.table(df, freeze_columns_left=[...]) rejected pandas index names even though the frontend already renders row headers as the leftmost columns and pins anything in the left array. Users who tried to freeze a named index, a MultiIndex level, or the default unnamed index hit ValueError: Column '<name>' not found in table.

Validation now widens the left-side allowed set to include row-header names from TableManager.get_row_headers(). The right side keeps only table columns; passing a row-header name there raises a friendly error pointing the user to freeze_columns_left, since row headers can never render on the right. Non-pandas backends return no row headers, so their behavior is unchanged.

Closes #9418

`mo.ui.table(df, freeze_columns_left=[...])` rejected pandas index names
even though the frontend already renders row headers as the leftmost
columns and pins anything in the `left` array. Users who tried to freeze
a named index, a MultiIndex level, or the default unnamed index hit
`ValueError: Column '<name>' not found in table.`

Validation now widens the left-side allowed set to include row-header
names from `TableManager.get_row_headers()`. The right side keeps only
table columns; passing a row-header name there raises a friendly error
pointing the user to `freeze_columns_left`, since row headers can never
render on the right. Non-pandas backends return no row headers, so their
behavior is unchanged.

Closes #9418
@vercel
Copy link
Copy Markdown

vercel Bot commented May 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment May 20, 2026 10:27pm

Request Review

@kirangadhave kirangadhave marked this pull request as ready for review May 20, 2026 20:18
@kirangadhave
Copy link
Copy Markdown
Member Author

@cubic-dev-ai

Copilot AI review requested due to automatic review settings May 20, 2026 20:18
@kirangadhave kirangadhave added the bug Something isn't working label May 20, 2026
@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai Bot commented May 20, 2026

@cubic-dev-ai

@kirangadhave I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Re-trigger cubic

@kirangadhave kirangadhave requested a review from mscolnick May 20, 2026 20:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Extends mo.ui.table(..., freeze_columns_left=...) validation to allow freezing pandas index-derived “row header” columns (including named indexes and MultiIndex levels), aligning backend validation with the frontend’s existing ability to pin row headers on the left.

Changes:

  • Include row-header names (from TableManager.get_row_headers()) as valid targets for freeze_columns_left.
  • Reject row-header names in freeze_columns_right with a clearer error directing users to freeze_columns_left.
  • Add pandas-focused tests covering unnamed indexes, named indexes, MultiIndex levels, name-collision suffixing, and right-side rejection.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
marimo/_plugins/ui/_impl/table.py Expands frozen-column validation to include row headers on the left and adds a friendly error for row headers on the right.
tests/_plugins/ui/_impl/test_table.py Adds regression tests ensuring pandas index row headers can be frozen on the left and are rejected on the right.

Comment thread marimo/_plugins/ui/_impl/table.py Outdated
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 2 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread marimo/_plugins/ui/_impl/table.py
The frontend generates a synthetic id like `__m_column__0` for unnamed
row-header columns, so accepting `freeze_columns_left=[""]` on the
backend passed validation but pinned nothing client-side. Reject the
empty-string case up front and tell the user to name their index.
Reuse a single row_headers binding for the validation set and the
component args instead of calling the manager twice.
@kirangadhave kirangadhave merged commit 61be008 into main May 21, 2026
44 checks passed
@kirangadhave kirangadhave deleted the kg/table-freeze-index-columns branch May 21, 2026 00:49
@github-actions
Copy link
Copy Markdown

🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.23.7-dev68

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mo.ui.table cannot freeze index columns (only DataFrame columns are supported)

3 participants