Spark - Sum of row values

前端 未结 5 1143
囚心锁ツ
囚心锁ツ 2020-12-09 13:57

I have the following DataFrame:

January | February | March
-----------------------------
  10    |    10    |  10
  20    |    20    |  20
  50    |    50            


        
5条回答
  •  情话喂你
    2020-12-09 14:22

    You can use expr() for this.In scala use

    df.withColumn("TOTAL", expr("January+February+March"))
    

提交回复
热议问题