-
Notifications
You must be signed in to change notification settings - Fork 113
Closed
Description
Currently, the DataGrid supports polars by calling its polars.DataFrame.to_pandas()
method. From pairing with @schloerke, I can take a pass at supporting polars directly in the DataGrid. This will give me a chance to see what DataFrame specific logic is in there.
TODO:
- Separate out DataFrame specific logic (similar to in Great Tables _tbl_data.py)
- Should not create hard dependencies on any given DataFrame library
- Should handle polars dtypes (a big part of the DataFrame specific logic right now).
- After submitting PR, all the DataFrame-specific logic should be in one place, so I can evaluate plugging in narwhals
Example app
from shiny.express import render
import polars as pl
df = pl.DataFrame({"x": [1,2,3], "y": ["a", "b", "c"], "z": [{"val": 1}, {"val": 2}, {"val": 3}]})
@render.data_frame
def frame():
return render.DataGrid(df)
NOTES:
- htmltools.HTML subclasses str, but this causes polars.Series to coerce it to str. This means that you can't get HTML back. (subclassing UserString or something avoids this behavior).
Metadata
Metadata
Assignees
Labels
data frameRelated to @render.data_frameRelated to @render.data_frame