title: pyspark approxQuantile function
body: <p>I have dataframe with these columns <code>id</code>, <code>price</code>, <code>timestamp</code>.</p>
  
  <p>I would like to find median value grouped by <code>id</code>.</p>
  
  <p>I am using this code to find it but it's giving me this error.</p>
  
  
  
  <pre class="lang-python prettyprint-override"><code>from pyspark.sql import DataFrameStatFunctions as statFunc
  windowSpec = Window.partitionBy("id")
  median = statFunc.approxQuantile("price",
                                   [0.5],
                                   0) \
                   .over(windowSpec)
  
  return df.withColumn("Median", median)
  </code></pre>
  
  <p>Is it not possible to use <code>DataFrameStatFunctions</code> to fill values in new column?</p>
  
  <pre class="lang-python prettyprint-override"><code>TypeError: unbound method approxQuantile() must be called with DataFrameStatFunctions instance as first argument (got str instance instead)
  </code></pre>