Skip to content

Conversation

@mscolnick
Copy link
Contributor

@mscolnick mscolnick commented Jan 22, 2026

Fixes an issue where pandas DataFrame index columns display empty cells in the marimo UI when using pandas 3.0+.

Fixes #7942

Problem

In pandas 3.0, when setting a sequential integer column as an index (e.g., df.set_index('Year')), pandas optimizes it to a RangeIndex with a custom name instead of creating an Int64Index (pandas 2.x behavior).

The existing code in pandas_table.py excluded ALL RangeIndex instances from being reset to columns, including those with custom names. This caused the index values to be missing from the JSON output sent to the frontend, resulting in empty cells.

Solution

Modified the condition in to_json_str() to only skip unnamed RangeIndex instances (the default 0,1,2,... index). Named RangeIndex instances are now properly reset to columns and included in the JSON output.

## Summary

Fixes an issue where pandas DataFrame index columns display empty cells in the marimo UI when using pandas 3.0+.

## Problem

In pandas 3.0, when setting a sequential integer column as an index (e.g., `df.set_index('Year')`), pandas optimizes it to a `RangeIndex` with a custom name instead of creating an `Int64Index` (pandas 2.x behavior).

The existing code in `pandas_table.py` excluded ALL `RangeIndex` instances from being reset to columns, including those with custom names. This caused the index values to be missing from the JSON output sent to the frontend, resulting in empty cells.
@vercel
Copy link

vercel bot commented Jan 22, 2026

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

Project Deployment Review Updated (UTC)
marimo-docs Ready Ready Preview, Comment Jan 22, 2026 10:25pm

Request Review

@mscolnick mscolnick added the bug Something isn't working label Jan 22, 2026
@mscolnick mscolnick merged commit 3127f40 into main Jan 22, 2026
54 of 60 checks passed
@mscolnick mscolnick deleted the ms/fix-pandas-30-range branch January 22, 2026 22:51
botterYosuke pushed a commit to botterYosuke/marimo that referenced this pull request Jan 23, 2026
…) (marimo-team#7944)

Fixes an issue where pandas DataFrame index columns display empty cells
in the marimo UI when using pandas 3.0+.

Fixes marimo-team#7942

### Problem

In pandas 3.0, when setting a sequential integer column as an index
(e.g., `df.set_index('Year')`), pandas optimizes it to a `RangeIndex`
with a custom name instead of creating an `Int64Index` (pandas 2.x
behavior).

The existing code in `pandas_table.py` excluded ALL `RangeIndex`
instances from being reset to columns, including those with custom
names. This caused the index values to be missing from the JSON output
sent to the frontend, resulting in empty cells.

### Solution

Modified the condition in `to_json_str()` to only skip unnamed
`RangeIndex` instances (the default 0,1,2,... index). Named `RangeIndex`
instances are now properly reset to columns and included in the JSON
output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

2 participants