How to get a value from the Row object in Spark Dataframe?

后端 未结 3 798
刺人心
刺人心 2020-12-06 09:49

for

averageCount = (wordCountsDF
                .groupBy().mean()).head()

I get

Row(avg(count)=1.6666666666666667)

3条回答
  •  清歌不尽
    2020-12-06 10:41

    I figured it out. This will return me the value:

    averageCount = (wordCountsDF
                    .groupBy().mean()).head()[0]
    

提交回复
热议问题