posit-dev / great-tables

Make awesome display tables using Python.
https://posit-dev.github.io/great-tables/
MIT License
1.81k stars 60 forks source link

support any frames with __dataframe__ #229

Open machow opened 7 months ago

machow commented 7 months ago

See https://data-apis.org/dataframe-api/draft/. This protocol allows DataFrames to expose a version of themselves that supports a shared set of methods. We could use this to implement a third kind of frame support: supporting frames implementing this interface.

For an initial implementation, we probably wouldn't accept much beyond basic column selection. But in the deep future, could allow integration with their lazy expression systems (e.g. a lazy expression from some frame system gets applied to the frame, using great_tables._tbl_data.eval_transform(), dispatched on the corresponding, underlying frame.