narwhals icon indicating copy to clipboard operation
narwhals copied to clipboard

[Enh]: Add `pivot` to Arrow

Open tylerriccio33 opened this issue 9 months ago • 3 comments

We would like to learn about your use case. For example, if this feature is needed to adopt Narwhals in an open source project, could you please enter the link to it below?

No response

Please describe the purpose of the new feature or describe the problem to solve.

Implement the pivot function for Arrow. Discovered as missing in #2177.

Suggest a solution if possible.

No response

If you have tried alternatives, please describe them below.

No response

Additional information that may help us understand your needs.

No response

tylerriccio33 avatar Mar 09 '25 23:03 tylerriccio33

thanks - this may need implementing a bit manually as in the last example from https://docs.pola.rs/api/python/stable/reference/dataframe/api/polars.DataFrame.pivot.html

MarcoGorelli avatar Mar 09 '25 23:03 MarcoGorelli

Somewhat recently, pyarrow added (pa.compute.pivot_wider) that might help.

Pretty classic pyarrow to manage to not add this as a method on pa.Table 🙃

dangotbanned avatar Jun 25 '25 17:06 dangotbanned

Added high prio label as it was requested in discord as well - I think it is both in scope and doable (must double check performance though 🙈)

FBruzzesi avatar Sep 04 '25 14:09 FBruzzesi