- 
                Notifications
    You must be signed in to change notification settings 
- Fork 748
improvement: migrate mo.ui.dataframe to narwhals; support duckdb, ibis, pandas, polars #6772
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| The latest updates on your projects. Learn more about Vercel for GitHub. 
 | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR migrates the mo.ui.dataframe component to use narwhals as the backend abstraction layer, expanding support from just pandas and polars to include duckdb, ibis, pandas, and polars. This reduces maintenance burden by consolidating dataframe handling logic under a single API while fixing duckdb filtering when using mo.ui.table().
- Replaces individual transform handlers (PandasTransformHandler, PolarsTransformHandler, IbisTransformHandler) with a unified NarwhalsTransformHandler
- Updates test infrastructure to use parameterized tests with create_dataframes helper
- Changes column ID types from Union[str, int] to str for consistency across backends
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description | 
|---|---|
| tests/_plugins/ui/_impl/dataframes/test_print_code.py | Updates tests to use NarwhalsTransformHandler and narwhals lazy dataframes | 
| tests/_plugins/ui/_impl/dataframes/test_handlers.py | Refactors tests to use unified narwhals approach with helper functions | 
| tests/_plugins/ui/_impl/dataframes/test_dataframe.py | Updates dataframe tests to work with narwhals-backed implementation | 
| marimo/_smoke_tests/dataframes/transforms.py | Adds smoke test script for testing transforms across multiple dataframe backends | 
| marimo/_plugins/ui/_impl/dataframes/transforms/types.py | Updates type definitions to use narwhals types and removes int from ColumnId | 
| marimo/_plugins/ui/_impl/dataframes/transforms/handlers.py | Replaces backend-specific handlers with unified NarwhalsTransformHandler | 
| marimo/_plugins/ui/_impl/dataframes/transforms/apply.py | Updates transform application to work with narwhals lazy frames | 
| marimo/_plugins/ui/_impl/dataframes/dataframe.py | Modifies dataframe component to use narwhals internally while preserving external API | 
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This migrates
mo.ui.dataframelogic to be backed by narwhals to both 1) reduce maintenance burden, 2) support more dataframe types.We now support: duckdb, ibis, pandas, polars
This will also fix duckdb filtering when using
mo.ui.table()