title: How to find the median in Apache Spark with Python Dataframe API?
body: <p>PySpark API provides many aggregate functions except the median. Spark 2 comes with <code>approxQuantile</code> which gives approximate quantiles but exact median is very expensive to calculate. Is there a more PySpark way of calculating median for a column of values in a Spark Dataframe?</p>