Extend DataFrame parameter support to other libraries#975
Extend DataFrame parameter support to other libraries#975philippjfr wants to merge 8 commits intomainfrom
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #975 +/- ##
==========================================
- Coverage 86.70% 86.38% -0.32%
==========================================
Files 10 10
Lines 5151 5201 +50
==========================================
+ Hits 4466 4493 +27
- Misses 685 708 +23 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@hoxbro @MarcSkovMadsen would love your thoughts. I'd like to think about Narwhals support but am wondering if that may be better implemented as a new parameter type. |
Co-authored-by: Simon Høxbro Hansen <simon.hansen@me.com>
Co-authored-by: Simon Høxbro Hansen <simon.hansen@me.com>
|
My POC for how this should be done from param over panel to bokeh is in https://github.com/panel-extensions/panel-graphic-walker/blob/89d6bac66d119d6ad1f75dfe27ec984d18d895ed/src/panel_gwalker/_tabular_data.py#L1 My broader vision for tabular support is in narwhals-dev/narwhals#1289 (comment). My recommendation would by to first implement this e2e in panel-graphic-walker. That is a place where its really easy to get this working and experimenting e2e. Its also a practical example that will help us have a specific discussion solving real problems. |
|
@hoxbro @maximlt I know you two discussed this before and your initial suggestion was that we should introduce a new Parameter class, because this is potentially confusing and over-complicated. I'm wary of creating a new parameter given the history of situations like CalendarDate, Date and the ObjectSelector, Selector mess, which in my experience also just leads to confusion. Overloading the Parameter does carry risk of confusion too and backward compatibility is a bit hard to reason about. So my concerns with this implementation are:
|
|
Well, Pandas and Polars DataFrames have pretty different APIs. So how useful is a |
|
If we want to have a single
|
I do not think we should do this. It breaks our contract with the user of Parameterized code. Users of a DataFrame parameter have been able to write code where they know they can invoke Pandas methods on the That said, I'm concerned about a |
As we begin to broaden support for different DataFrame libraries in our ecosystem we need to start at the bottom and work our way up. This PR makes it possible for
param.DataFrameto be extended with support for other DataFrame libraries and adds initial support for acceptingpolarsDataFrameandLazyFrameobjects. For now we maintain backwards compatibility here and require the user to explicitly define which libraries they want to support by providing alibrariesargument.