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
here is the alternative:
df.first()['column name']
it will give you the desired output. you can store it in a variable.
I think you're looking for collect
. Something like this should get you the value:
df.collect()[0]['count(DISTINCT AP)']
assuming the column name is 'count(DISTINCT AP)'