Skip to content

fix(table): preserve null extension-array values in JSON (#10299)#10326

Draft
hsusul wants to merge 1 commit into
marimo-team:mainfrom
hsusul:fix-table-extension-null-serialization
Draft

fix(table): preserve null extension-array values in JSON (#10299)#10326
hsusul wants to merge 1 commit into
marimo-team:mainfrom
hsusul:fix-table-extension-null-serialization

Conversation

@hsusul

@hsusul hsusul commented Jul 25, 2026

Copy link
Copy Markdown

This pull request was authored by a coding agent.

📝 Summary

Closes #10299

Problem

When a pandas DataFrame column contains an extension array (such as pint-pandas) with missing values (pd.NA, None, np.nan), PandasTableManager._to_json_str calls _extension_column_needs_stringify(result[col]) and unconditionally performs result[col] = result[col].astype(str). This stringifies missing cells into literal text like "<NA> meter" (or "nan") instead of JSON null.

Fix

Convert valid non-missing cells in extension columns to string (astype(str)), while using .astype(object).where(series.notna(), None) so missing entries remain None and serialize to JSON null as expected.

📋 Pre-Review Checklist

  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • Any AI generated code has been reviewed line-by-line by the human PR author, who stands by it.
  • Video or media evidence is provided for any visual changes (optional).

✅ Merge Checklist

  • I have read the contributor guidelines.
  • Documentation has been updated where applicable, including docstrings for API changes.
  • Tests have been added for the changes made.

Testing

  • uv run --group test pytest tests/_plugins/ui/_impl/tables/test_pandas_table.py — Passed (122 passed).
  • uv run ruff check marimo/ tests/ — Passed with 0 errors.
  • uv run ruff format --check marimo/ tests/ — Passed with 0 issues.

@hsusul

hsusul commented Jul 25, 2026

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment Jul 25, 2026 4:28am

Request Review

@github-actions

Copy link
Copy Markdown
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@hsusul

hsusul commented Jul 25, 2026

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

I have read the CLA Document and I hereby sign the CLA

@hsusul

hsusul commented Jul 25, 2026

Copy link
Copy Markdown
Author

recheck

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.

Missing pint-pandas values render as text ("<NA> meter") in table JSON instead of null

1 participant