How to extract value from pyspark.sql.function?
<p>I'm using some pyspark.sql.functions:</p>

<pre><code>print(ratings.select(mean('rating')).take(1))
print(ratings.select(stddev('rating')).take(1))
</code></pre>

<p>The output is:</p>

<pre><code>[Row(avg(rating)=3.581564453029317)]
[Row(stddev_samp(rating,0,0)=1.1171018453732544)]
</code></pre>

<p>How can I extract the value so that I can assign it to a variable, e.g.</p>

<pre><code>mean_ratings = ratings.select(mean('rating'))
</code></pre>