[Python] Apply a function to 2 columns in Polars [duplicate]

Discussão em 'Python' iniciado por Stack, Julho 3, 2025.

  1. Stack

    Stack Membro Participativo

    I want to apply a custom function which takes 2 columns and outputs a value based on those (row-based)

    In Pandas there is a syntax to apply a function based on values in multiple columns

    df['col_3'] = df.apply(lambda x: func(x.col_1, x.col_2), axis=1)


    What is the syntax for this in Polars?

    Continue reading...

Compartilhe esta Página