Closed
Description
Narwhals is a compatibility layer between Polars, pandas, and other dataframes.
https://narwhals-dev.github.io/narwhals/
This issue is to explore what changes we would need to make to use Narwhals in Plotly Express.
Narwhals is a compatibility layer between Polars, pandas, and other dataframes.
https://narwhals-dev.github.io/narwhals/
This issue is to explore what changes we would need to make to use Narwhals in Plotly Express.
Activity
firai commentedon Sep 11, 2024
I'm glad that this is being explored! Especially since
pandas
3.0 could still add a hard dependency onpyarrow
(seems to be their current plan unless the new PDEP delaying the dependency is approved), and since bothpyarrow
andpandas
seem to be required required now forpolars
to work with Plotly Express.Not sure if pointing this out here is kosher, and you may already be aware of this, but I understand that this is the (main) PR where
altair
switched to usingnarwhals
, just for reference: vega/altair#3452. If it's not kosher, feel free to edit this out.FBruzzesi commentedon Sep 24, 2024
Hey there! Thanks for considering Narwhals as an option to make the Plotly Express module more dataframe agnostic.
I started to take a look at how that would look like, and I believe that there are a couple of things worth mentioning:
DataFrame.unpivot
andDataFrame.cast
methods, both are work in progress)Time permitting, when those WIP features will be merged and released, I will take a closer look again.
Edit: For progress updates 😁 branch I am working on
ndrezn commentedon Oct 7, 2024
Hey Francesco! It looks like you've made great progress so far. Is there anything the Plotly team can do to support what you're working on? We're very interested in taking this feature further. For now we're working on typed array support in #4470, and I can imagine that Narwhals support could take this integration even further. Cheers!
FBruzzesi commentedon Oct 7, 2024
Yes the PR is almost ready, I am able to run the entire test suite successfully with polars and pyarrow on a narwhals branch (with features from narwhals-dev/narwhals#1145). Other required feature are also in main but not released just yet.
As soon as we make a new release I should be able to open the PR. I would expect to be of a similar size of #4470 in terms on line changes. I was wondering if there is a good approach to make it easier for review other than commenting it in great details.
Let me cc @MarcoGorelli as well into the thread 😁
FBruzzesi commentedon Oct 9, 2024
Opening a PR as draft very soon, I am a bit unsure where to set the test dependencies and how CI is run 🙈