How to sum the values of one column of a dataframe in spark/scala

前端 未结 5 740
鱼传尺愫
鱼传尺愫 2020-12-08 07:03

I have a Dataframe that I read from a CSV file with many columns like: timestamp, steps, heartrate etc.

I want to sum the values of each column, for instance the tot

5条回答
  •  悲&欢浪女
    2020-12-08 07:21

    Simply apply aggregation function, Sum on your column

    df.groupby('steps').sum().show()
    

    Follow the Documentation http://spark.apache.org/docs/2.1.0/api/python/pyspark.sql.html

    Check out this link also https://www.analyticsvidhya.com/blog/2016/10/spark-dataframe-and-operations/

提交回复
热议问题