[Python] How can I sum multiple columns in a spark dataframe in pyspark?

Discussão em 'Python' iniciado por Stack, Junho 19, 2025.

  1. Stack

    Stack Membro Participativo

    I've got a list of column names I want to sum

    columns = ['col1','col2','col3']


    How can I add the three and put it in a new column ? (in an automatic way, so that I can change the column list and have new results)

    Dataframe with result I want:

    col1 col2 col3 result
    1 2 3 6

    Continue reading...

Compartilhe esta Página