Skip to content

[Enh]: support Expr.map_elements #3512

@deepyaman

Description

@deepyaman

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?

Pandera supports element-wise checks.

I'm currently working on a unifying Narwhals backend for Pandera (issue: unionai-oss/pandera#1894), and this is one of the gaps.

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

Provide a unifying abstraction to map a custom/user-defined function (UDF) to each element of a column.

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.

There was some hesitation around adding map_elements without a clear use case (not surprising), but I think we have a valid need.

yay thanks @DeaMariaLeon !

@vincentarelbundock if custom f-strings are on polars roadmap anyway, then perhaps we can wait a bit longer before introducing map_elements to Narwhals, I'm a little hesitant about that one

Originally posted by @MarcoGorelli in #1226

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions