How to extract a single (column/row) value from a dataframe using PySpark?

后端 未结 2 1271
故里飘歌
故里飘歌 2021-01-15 21:58

Here\'s my spark code. It works fine and returns 2517. All I want to do is to print \"2517 degrees\"...but I\'m not sure how to extract that 2517 into a variable. I can only

2条回答
  •  长发绾君心
    2021-01-15 22:24

    here is the alternative:

    df.first()['column name']
    

    it will give you the desired output. you can store it in a variable.

提交回复
热议问题