Skip to content
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

Explore dropping Pandas requirement for Plotly Express #4834

Open
ndrezn opened this issue Oct 25, 2024 · 2 comments
Open

Explore dropping Pandas requirement for Plotly Express #4834

ndrezn opened this issue Oct 25, 2024 · 2 comments
Labels
feature something new P2 considered for next cycle

Comments

@ndrezn
Copy link
Member

ndrezn commented Oct 25, 2024

In #4790, nearly all Pandas functionality is removed from Plotly.py, except some of our trendine functions.

Narwhals does not yet support rolling, expanding nor ewm, and until that support is added, we need to use Pandas to calculate trendlines.

Those functions are on the Narwhals roadmap, and we should have a quick follow-up in Plotly.py to implement those changes after the first set of Narwhals changes are made and the good folks at Narwhals release that update 🙂 .

See: https://github.com/plotly/plotly.py/pull/4790/files/6676061152527160b44dbf67ecf6b89e46eef3b2#diff-e667a84629ee8d2879cf22a88c8ff80bcfec1c35be69ab9f50be5938c7089ddaR114-R129

@ndrezn ndrezn changed the title Explore dropping Pandas requirement Explore dropping Pandas requirement for Plotly Express Oct 25, 2024
@gvwilson gvwilson added feature something new P2 considered for next cycle labels Oct 25, 2024
@FBruzzesi
Copy link
Contributor

FBruzzesi commented Oct 30, 2024

Commenting here to brainstorm how to eventually achieve this.

Currently it is possible to pass trendline_options to forward kwargs to the underlying (pandas) trendline function.

If we were to implement rolling and ewm in narwhals, they would have (a subset of) the polars respective method signature. This would result in a breaking change in plotly, as the pandas kwargs are different.

I think the most reasonable option would be to remap pandas arguments to narwhals with a deprecation warning for a first period, and eventually remove support for pandas specific.

Thoughts on it?

cc: @MarcoGorelli

@FBruzzesi
Copy link
Contributor

FBruzzesi commented Nov 16, 2024

Tiny update on this topic: after merging all the cumulative features supported from polars into the narwhals api, I am able to replicate almost all the univariate expanding functions that pandas supports. The following 3 are sadly left out: median, quantile, and rank. I don't really see a way to implement them without a loop for polars and pyarrow considering their api's.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new P2 considered for next cycle
Projects
None yet
Development

No branches or pull requests

3 participants